job
Module to interact with jobs.
This module contains class to interact with a job in EMS data integration.
Typical usage example:
```python
job = data_pool.get_job(job_id)
job.name = "NEW_NAME"
job.update()
job.execute()
data_model_execution = job.get_data_model_execution("<EXECUTION_ID_HERE>")
job.execute(
transformation_ids=[transformation.id],
data_model_execution_configurations=[
DataModelExecutionConfiguration(
data_model_execution_id=data_model_execution.id,
tables=[t.id for t in data_model_execution.tables],
)
],
)
job.delete()
```
Job ¶
Bases: JobTransport
Data job object to interact with data job specific data integration endpoints.
current_execution_id
class-attribute
instance-attribute
¶
dag_based_execution_enabled
class-attribute
instance-attribute
¶
latest_execution_item_id
class-attribute
instance-attribute
¶
from_transport
classmethod
¶
Creates high-level job object from given JobTransport.
Parameters:
-
client
(Client
) –Client to use to make API calls for given job.
-
job_transport
(JobTransport
) –JobTransport object containing properties of job.
Returns:
-
Job
–A Job object with properties from transport and given client.
copy_to ¶
copy_to(
destination_team_domain,
destination_data_pool_id,
destination_data_source_id=None,
**kwargs
)
Copies data job to the specified domain in the same realm.
Parameters:
-
destination_team_domain
(str
) –The
of the destination team url, https:// . .celonis.cloud/ -
destination_data_pool_id
(str
) –The id of the destination data pool.
-
destination_data_source_id
(Optional[str]
, default:None
) –(Optional) The id of the destination data connection. By default, the global data source is used.
-
**kwargs
(Any
, default:{}
) –Additional parameters set for JobCopyRequestTransport
Returns:
-
JobTransport
–A read-only job transport object of the copied asset.
Examples:
create_task ¶
Creates new task with name in given data job.
Parameters:
-
name
(str
) –Name of new task.
-
task_type
(TaskType
) –Type of new task.
-
description
(Optional[str]
, default:None
) –Description of new task.
-
**kwargs
(Any
, default:{}
) –Additional parameters set for NewTaskInstanceTransport object.
Returns:
-
Task
–A Task object for newly created task.
create_transformation ¶
Creates new transformation task with name in given data job.
Parameters:
-
name
(str
) –Name of new transformation task.
-
description
(Optional[str]
, default:None
) –Description of new transformation task
-
**kwargs
(Any
, default:{}
) –Additional parameters set for NewTaskInstanceTransport object.
Returns:
-
Task
–A Task object for newly created transformation task.
Examples:
Create data job with transformation statement and execute it:
data_job = data_pool.create_job("PyCelonis Tutorial Job")
task = data_job.create_transformation(
name="PyCelonis Tutorial Task",
description="This is an example task"
)
task.update_statement(\"\"\"
DROP TABLE IF EXISTS ACTIVITIES;
CREATE TABLE ACTIVITIES (
_CASE_KEY VARCHAR(100),
ACTIVITY_EN VARCHAR(300)
);
\"\"\")
data_job.execute()
create_extraction ¶
Creates new extraction task with name in given data job.
Parameters:
-
name
(str
) –Name of new extraction task.
-
**kwargs
(Any
, default:{}
) –Additional parameters set for NewTaskInstanceTransport object.
Returns:
-
Task
–A Task object for newly created extraction task.
get_task ¶
Gets task with given id.
Parameters:
-
id_
(str
) –Id of task.
Returns:
-
Task
–A Task object for task with given id.
get_tasks ¶
get_transformations ¶
Gets all transformations of given data job.
Returns:
-
CelonisCollection[Task]
–A list containing all transformations.
get_extractions ¶
Gets all extractions of given data job.
Returns:
-
CelonisCollection[Task]
–A list containing all extractions.
execute ¶
execute(
transformation_ids=None,
extraction_configurations=None,
data_model_execution_configurations=None,
mode=ExtractionMode.DELTA,
wait=True,
**kwargs
)
Executes job with given transformations, extractions, and data model executions.
Parameters:
-
transformation_ids
(Optional[List[str]]
, default:None
) –Ids of transformations to use. Default is None which executes all transformations.
-
extraction_configurations
(Optional[List[ExtractionConfiguration]]
, default:None
) –Extraction configurations to define which extractions to execute. Default is None which executes all extractions.
-
data_model_execution_configurations
(Optional[List[DataModelExecutionConfiguration]]
, default:None
) –Data model execution configurations to define which data model reloads to execute. Default is None which executes all data model reloads. If configuration is given it needs to contain all table ids to reload.
-
mode
(ExtractionMode
, default:DELTA
) –Extraction mode. Default is DELTA.
-
wait
(bool
, default:True
) –If true, function only returns once data job has been executed and raises error if it fails. It does only wait until the job has finished and not until all data models have been reloaded. If false, function returns after triggering execution and does not raise errors in case it failed.
-
**kwargs
(Any
, default:{}
) –Additional parameters set for JobExecutionConfiguration object.
Examples:
Create data job with transformation statement and execute it:
data_job = data_pool.create_job("PyCelonis Tutorial Job")
task = data_job.create_transformation(
name="PyCelonis Tutorial Task",
description="This is an example task"
)
task.update_statement(\"\"\"
DROP TABLE IF EXISTS ACTIVITIES;
CREATE TABLE ACTIVITIES (
_CASE_KEY VARCHAR(100),
ACTIVITY_EN VARCHAR(300)
);
\"\"\")
data_job.execute()
get_current_execution_status ¶
Gets the current execution status of the job.
create_data_model_execution ¶
Creates data model execution in given data job.
Parameters:
-
data_model_id
(str
) –Id of data model to reload.
-
table_ids
(Optional[List[str]]
, default:None
) –Ids of tables to reload. Defaults to full load.
-
**kwargs
(Any
, default:{}
) –Additional parameters set for DataModelExecutionTransport object.
Returns:
-
DataModelExecution
–A DataModelExecution object for newly created data model execution.
get_data_model_execution ¶
Gets data model execution with given id.
Parameters:
-
id_
(Optional[str]
) –Id of data model execution.
Returns:
-
DataModelExecution
–A DataModelExecution object for data model execution with given id.
get_data_model_executions ¶
Gets all data model executions of given data job.
Returns:
-
CelonisCollection[DataModelExecution]
–A list containing all data model executions.