data_model.py
Datamodel (CelonisApiObjectChild)
¶
Datamodel object to interact with Celonis Event Collection API.
url: str
property
readonly
¶
API
/integration/api/pools/{pool_id}/data-models/{datamodel_id}
tables: CelonisCollection[DatamodelTable]
property
readonly
¶
Get all Datamodel Tables.
API
GET: /integration/api/pools/{pool_id}/data-model/{datamodel_id}/tables/{table_id}
Returns:
Type | Description |
---|---|
CelonisCollection[DatamodelTable] |
Collection of Datamodel Tables. |
process_configuration: DatamodelProcessConfiguration
property
readonly
¶
Get the Datamodels Process Configuration.
Warning
This method is deprecated. Use celonis_api.event_collection.data_model.Datamodel.process_configurations:
Returns:
Type | Description |
---|---|
DatamodelProcessConfiguration |
The first Process Configuration of the all Datamodels Process Configurations. |
process_configurations: CelonisCollection[DatamodelProcessConfiguration]
property
readonly
¶
Get all Datamodels Process Configurations.
API
GET: /integration/api/pools/{pool_id}/data-models/{datamodel_id}/process-configurations
Returns:
Type | Description |
---|---|
CelonisCollection[DatamodelProcessConfiguration] |
A Collection the Datamodel's Process Configurations. |
default_activity_table: Optional[DatamodelTable]
property
writable
¶
Get/Set the default Activity Table via Process Configuration.
API
PUT: /integration/api/pools/{pool_id}/data-models/process-configurations/default-activity-table
Returns:
Type | Description |
---|---|
Optional[DatamodelTable] |
The default Activity Table. |
case_table_key: List
property
readonly
¶
Get all Case Table Keys.
Returns:
Type | Description |
---|---|
List |
Sorted List of Case Table Keys. |
foreign_keys: ForeignKeyList
property
readonly
¶
Get all Foreign Keys.
Returns:
Type | Description |
---|---|
ForeignKeyList |
A List of Foreign Keys. |
load_status: Dict
property
readonly
¶
Get the Datamodels Load Status.
API
GET: /integration/api/pools/{pool_id}/data-models/{datamodel_id}/load-history/load-info-sync
Returns:
Type | Description |
---|---|
Dict |
Load status. |
workspaces: CelonisCollection[Workspace]
property
readonly
¶
Get all Process Mining Workspaces. Uses celonis_api.celonis.Celonis.workspaces.
Returns:
Type | Description |
---|---|
CelonisCollection[Workspace] |
Collection of Workspaces. |
last_change_dates: DataFrame
property
readonly
¶
Returns the latest change date found in tables.
name_mapping: Dict
property
readonly
¶
Get the Datamodels Name Mappings.
API
GET: /integration/api/pools/{pool_id}/data-models/{datamodel_id}/name-mapping
Returns:
Type | Description |
---|---|
Dict |
Dictionary containing the Name Mappings. |
create_process_configuration(self, activity_table=None, case_table=None, case_column=None, activity_column=None, timestamp_column=None, sorting_column=None)
¶
Creates a new Process Configuration.
API
PUT: /integration/api/pools/{pool_id}/data-models/{datamodel_id}/process-configurations
Parameters:
Name | Type | Description | Default |
---|---|---|---|
activity_table |
Union[str, DatamodelTable] |
Name of Activity Table or DatamodelTable object. |
None |
case_table |
Union[str, DatamodelTable] |
Name of Case Table or DatamodelTable object. |
None |
case_column |
str |
Case Column Name referring to column in activity table. |
None |
activity_column |
str |
Activity Column Name referring to column in activity table. |
None |
timestamp_column |
str |
Timestamp Column Name referring to column in activity table. |
None |
sorting_column |
str |
Sorting Column Name. |
None |
Returns:
Type | Description |
---|---|
CelonisCollection[DatamodelProcessConfiguration] |
A Collection the Datamodel's Process Configurations. |
create_foreign_key(self, source_table, target_table, columns, **kwargs)
¶
Creates a new Foreign Key between the source_table (child(1)) and the target_table (parent(N)).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source_table |
Union[str, DatamodelTable] |
Name of Source Table or DatamodelTable object. |
required |
target_table |
Union[str, DatamodelTable] |
Name of Target Table or DatamodelTable object. |
required |
columns |
List[Tuple[str, str]] |
List of 2D-tuples consisting of a 'sourceColumnName' and 'targetColumnName' which represents the foreign_key, e.g. foreign_key_columns=[('Col1', 'Col3'), ('Col2', 'Col2'), ..] |
required |
Returns:
Type | Description |
---|---|
Dict |
The newly created Foreign Key configuration as Dictionary. |
Exceptions:
Type | Description |
---|---|
PyCelonisValueError |
If tables not found or columns not found or foreign key connection already exists between the specified tables. |
PyCelonisTypeError |
If table columns have different data types. |
push_table(self, df_or_path, table_name, reload_datamodel=True, **kwargs)
¶
Pushes a table to a Pool, adds it the Datamodel and by default reloads the Datamodel.
Warning
This method is deprecated. Use create_table.
Returns:
Type | Description |
---|---|
DatamodelTable |
The newly added Datamodel Table. |
reload(self, from_cache=False, tables=None, wait_for_reload=True)
¶
Reloads the Datamodel only if a reload is not already running.
API
POST: /integration/api/pools/{pool_id}/data-models/{datamodel_id}/reload
Parameters:
Name | Type | Description | Default |
---|---|---|---|
from_cache |
bool |
Deprecated, as it is no longer supported for data models. Will always be set to False. |
False |
tables |
List |
List of Datamodel Tables or table ids. If given a partial reload will be performed on these tables, from_cache will be ignored. |
None |
wait_for_reload |
bool |
If True waits until the Datamodel is reloaded. |
True |
Returns:
Type | Description |
---|---|
Dict |
Report of the reload. |
add_table_from_pool(self, table_name, alias=None, connection=None, new_foreign_key_to_table=None, added_table_join_type='source', foreign_key_columns=None, reload=None)
¶
Adds a Table from Pool to Datamodel. If the Table names and the ey parameters are provided it also can connect two tables directly.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
table_name |
str |
Name of the table to be added in the Pool. |
required |
alias |
str |
An alias name for the new table, by default None |
None |
added_table_join_type |
str |
Add table to be pushed as 'source' table or as 'target' table regarding
the connection. One of [ |
'source' |
new_foreign_key_to_table |
str |
Set connection to or from this table. |
None |
foreign_key_columns |
List 2D-tuples consisting of a 'sourceColumnName' and 'targetColumnName' which represents the foreign_key, e.g. foreign_key_columns=[('Col1', 'Col3'), ('Col2', 'Col2'), ..] between two tables. |
None |
|
connection |
Union[DataConnection, str] |
DataConnection object or ID, uses Global if not specified. |
None |
reload |
str |
Reload type. One of [ |
None |
Returns:
Type | Description |
---|---|
DatamodelTable |
DatamodelTable. |
create_workspace(self, name)
¶
get_data_file(self, pql_query, file_path=None, verify_query=False, **kwargs)
¶
Exports the results of a PQL query as pyarrow.parquet.ParquetFile and returns the path to the exported file. Uses celonis_api.event_collection.compute_node.ComputeNode.get_data_file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pql_query |
PQL |
The table query to be executed. |
required |
file_path |
Union[str, pathlib.Path] |
The output path for the export. Defaults to |
None |
verify_query |
bool |
Whether query should be verified before execution. |
False |
Returns:
Type | Description |
---|---|
Path |
Path to downloaded file containing the results of the query. |
download_name_mapping(self, file_path='name_mapping.xlsx')
¶
Downloads the Datamodels Name Mappings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
Union[str, pathlib.Path] |
Download path to Excel File. |
'name_mapping.xlsx' |
Returns:
Type | Description |
---|---|
Path |
Path to downloaded Excel File. |
upload_name_mapping(self, file_path)
¶
Uploads the Datamodels Name Mappings Excel File.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
Union[str, pathlib.Path] |
Upload path to Excel File. |
required |
Returns:
Type | Description |
---|---|
Dict |
Upload Result. |
get_data_frame(self, query, verify_query=False, **kwargs)
¶
Exports the results of a PQL query as pyarrow.parquet.ParquetFile and converts it to a pandas.DataFrame. Uses ComputeNode.get_data_frame.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query |
PQL |
The table query to be executed. |
required |
verify_query |
bool |
Whether query should be verified before execution. |
False |
Returns:
Type | Description |
---|---|
DataFrame |
Dataframe containing the results of the query. |
DatamodelTable (CelonisApiObjectChild)
¶
Celonis DatamodelTable object to interact with Celonis Event Collection API.
url: str
property
readonly
¶
API
/integration/api/pools/{pool_id}/data-model/{datamodel_id}/tables/{datamodel_table_id}
columns: List
property
readonly
¶
Get all Datamodel Table Column Definitions
(e.g.: {'name': 'EVENTTIME_START', 'length': 26, 'type': 'DATE'}
).
API
GET: /integration/api/pools/{pool_id}/data-model/{datamodel_id}/tables/{datamodel_table_id}/columns
Returns:
Type | Description |
---|---|
List |
List of Column definitions. |
alias
property
writable
¶
Datamodel Table Alias.
source_name
property
writable
¶
Datamodel Table Name.
delete(self)
¶
Deletes the Datamodel Table.
API
DELETE: /integration/api/pools/{pool_id}/data-model/{datamodel_id}/tables/{datamodel_table_id}
get_data_frame(self, max_rows=None, verify_query=False, include_change_date=False, **kwargs)
¶
Exports the results of the Datamodel Table Columns PQL query as pyarrow.parquet.ParquetFile and converts it to a pandas.DataFrame. Uses Datamodel.get_data_frame.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
max_rows |
Optional[int] |
Limits the number of rows (e.g. max_rows = 100) that are queried. |
None |
verify_query |
bool |
Whether query should be verified before execution. |
False |
include_change_date |
bool |
Whether '_CELONIS_CHANGE_DATE' column is included or not. |
False |
Returns:
Type | Description |
---|---|
DataFrame |
Dataframe containing the results of the query. |
DatamodelProcessConfiguration (CelonisDataObject)
¶
Datamodel ProcessConfiguration object.
data
property
readonly
¶
A reference to the data of this object.
activity_table: DatamodelTable
property
readonly
¶
Get the Datamodels Process Configuration Activity Table.
Returns:
Type | Description |
---|---|
DatamodelTable |
Activity Table. |
case_table: DatamodelTable
property
readonly
¶
Get the Datamodels Process Configuration Case Table.
Returns:
Type | Description |
---|---|
DatamodelTable |
Case Table. |
case_column: str
property
readonly
¶
Get the Datamodels Process Configuration Case Column.
Returns:
Type | Description |
---|---|
str |
Case Column. |
activity_column: str
property
readonly
¶
Get the Datamodels Process Configuration Activity Column.
Returns:
Type | Description |
---|---|
str |
Activity Column. |
timestamp_column: str
property
readonly
¶
Get the Datamodels Process Configuration Timestamp Column.
Returns:
Type | Description |
---|---|
str |
Timestamp Column. |
sorting_column: str
property
readonly
¶
Get the Datamodels Process Configuration Sorting Column.
Returns:
Type | Description |
---|---|
str |
Sorting Column. |
default_configuration: bool
property
readonly
¶
Get whether the Datamodels Process Configuration is set to default.
Returns:
Type | Description |
---|---|
bool |
Process Configuration default status. |
edit_configuration(self, activity_table=None, case_table=None, case_column=None, activity_column=None, timestamp_column=None, sorting_column=None)
¶
Edit the Datamodels Process Configuration.
API
PUT: /integration/api/pools/{pool_id}/data-models/{datamodel_id}/process-configurations
Parameters:
Name | Type | Description | Default |
---|---|---|---|
activity_table |
DatamodelTable |
Name of Activity Table or DatamodelTable object. |
None |
case_table |
DatamodelTable |
Name of Case Table or DatamodelTable object. |
None |
case_column |
str |
Case Column Name referring to column in activity table. |
None |
activity_column |
str |
Activity Column Name referring to column in activity table. |
None |
timestamp_column |
str |
Timestamp Column Name referring to column in activity table. |
None |
sorting_column |
str |
Sorting Column Name. |
None |
Returns:
Type | Description |
---|---|
DatamodelProcessConfiguration |
Updated Process Configuration. |
ForeignKey (dict)
¶
Datamodel Foreign Key object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source_table |
DatamodelTable |
Source table of foreign key. |
required |
target_table |
DatamodelTable |
Target table of foreign key. |
required |
columns |
List[Tuple[str, str]] |
List of column tuples for foreign key. |
required |
ForeignKeyList (list)
¶
List of ForeignKey.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
foreign_keys_raw |
Dict |
Dictionary of raw foreign keys |
required |
tables |
CelonisCollection |
Collection of DatamodelTable |
required |
find_keys_by_source_name(self, name)
¶
Get all foreign keys with given source name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str |
Source name to search for (source name of table, not alias). |
required |
Returns:
Type | Description |
---|---|
List[celonis_api.event_collection.data_model.ForeignKey] |
List of foreign keys with the same source name. |
find_keys_by_target_name(self, name)
¶
Returns all foreign keys with given target name
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str |
Target name to search for (source name of table, not alias) |
required |
Returns:
Type | Description |
---|---|
List[celonis_api.event_collection.data_model.ForeignKey] |
List of foreign keys with the same target name. |
find_keys_by_name(self, name)
¶
Get all foreign keys with given target name or source name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str |
Target and/or source name to search for (source name of table, not alias). |
required |
Returns:
Type | Description |
---|---|
List[celonis_api.event_collection.data_model.ForeignKey] |
List of foreign keys with the same target name or same source name. |