Skip to content

data_model

Module to interact with data models.

This module contains class to interact with a data model in EMS data integration.

Typical usage example
data_model = data_pool.get_data_model(data_model_id)
data_model.name = "NEW_NAME"
data_model.update()
data_model.reload()
data_model.delete()

DataModel

Bases: DataModelTransport

Data model object to interact with data model specific data integration endpoints.

client class-attribute

client: Client = Field(Ellipsis, exclude=True)

id class-attribute

id: str

pool_id class-attribute

pool_id: str

from_transport classmethod

from_transport(client, data_model_transport)

Creates high-level data model object from given DataModelTransport.

Parameters:

  • client (Client) –

    Client to use to make API calls for given data model.

  • data_model_transport (DataModelTransport) –

    DataModelTransport object containing properties of data model.

Returns:

  • DataModel

    A DataModel object with properties from transport and given client.

data_pool_id writable property

data_pool_id()

Returns id of data pool for given data model.

update

update()

Pushes local changes of data model to EMS and updates properties with response from EMS.

sync

sync()

Syncs data model properties with EMS.

delete

delete()

Deletes data model.

reload

reload(force_complete=True, wait=True)

Reloads given data model.

Parameters:

  • force_complete (bool) –

    If true, complete reload is triggered. Else reload from cache is triggered.

  • wait (bool) –

    If true, function only returns once data model has been reloaded and raises error if reload fails. If false, function returns after triggering reload and does not raise errors in case load failed.

Raises:

partial_reload

partial_reload(data_model_table_ids, wait=True)

Only reloads given tables in data model.

Parameters:

  • data_model_table_ids (typing.List[str]) –

    List of data model table ids that needs to be reloaded.

  • wait (bool) –

    If true, function only returns once data model tables have been reloaded and raises error if reload fails. If false, function returns after triggering partial reload and does not raise errors in case load failed.

Raises:

add_table

add_table(name, alias=None, **kwargs)

Creates new data model with name in given data pool.

Parameters:

  • name (str) –

    Name of existing table in data pool.

  • alias (typing.Optional[str]) –

    Alias of new data model table.

  • **kwargs (typing.Any) –

    Additional parameters set for DataModelTableTransport object.

Returns:

  • DataModelTable

    A DataModelTable object for newly created data model table.

get_table

get_table(id_)

Gets data model table with given id.

Parameters:

  • id_ (str) –

    Id of data model table.

Returns:

  • DataModelTable

    A DataModelTable object for data model table with given id.

get_tables

get_tables()

Gets all data model tables of given data model.

Returns:

export_data_frame_from staticmethod

export_data_frame_from(
    client,
    pool_id,
    data_model_id,
    query,
    query_environment=None,
)

Creates new data export and downloads exported data as data frame for given data model.

This method should be used in case you only have USE ALL DATA MODELS or USE DATA MODEL permissions.

Parameters:

  • client (Client) –

    Client to use to make API calls for data export.

  • pool_id (str) –

    Id of data pool.

  • data_model_id (str) –

    Id of data model.

  • query (typing.Union[DataQuery, PQL]) –

    PQL query to export.

  • query_environment (typing.Optional[QueryEnvironment]) –

    Query environment KPIs.

Returns:

  • pd.DataFrame

    A data frame containing the exported data.

create_data_export

create_data_export(
    query, export_type, query_environment=None
)

Creates new data export in given data model.

Parameters:

Returns:

  • DataExport

    A DataExport object for newly created data export.

export_data_frame

export_data_frame(query, query_environment=None)

Creates new data export and downloads exported data as data frame.

Parameters:

  • query (typing.Union[DataQuery, PQL]) –

    PQL query to export.

  • query_environment (typing.Optional[QueryEnvironment]) –

    Query environment KPIs.

Returns:

  • pd.DataFrame

    A data frame containing the exported data.

create_foreign_key

create_foreign_key(
    source_table_id, target_table_id, columns
)

Creates new foreign key with name in given data model.

Parameters:

  • source_table_id (str) –

    Id of source table

  • target_table_id (str) –

    Id of target table

  • columns (typing.List[typing.Tuple[str, str]]) –

    List of 2D-tuples consisting of a 'sourceColumnName' and 'targetColumnName' which represents the foreign_key, e.g. columns=[('Col1', 'Col3'), ('Col2', 'Col2'), ..]

Returns:

  • ForeignKey

    A ForeignKey object for newly created foreign key.

get_foreign_key

get_foreign_key(id_)

Gets foreign key with given id.

Parameters:

  • id_ (str) –

    Id of foreign key.

Returns:

  • ForeignKey

    A ForeignKey object for foreign key with given id.

get_foreign_keys

get_foreign_keys()

Gets all foreign keys of given data pool.

Returns:

add_name_mappings

add_name_mappings(file_path)

Add the name mappings to data model.

Parameters:

  • file_path (typing.Union[str, pathlib.Path]) –

    Path of name mapping Excel file.

Returns:

get_name_mappings

get_name_mappings()

Gets name mappings of given data model.

Returns:

delete_name_mappings

delete_name_mappings()

Deletes name mappings of given data model.

create_process_configuration

create_process_configuration(
    activity_table_id,
    case_id_column,
    activity_column,
    timestamp_column,
    sorting_column=None,
    case_table_id=None,
    **kwargs
)

Creates new process configuration in given data model.

Parameters:

  • activity_table_id (str) –

    Id of activity table.

  • case_id_column (str) –

    Column name of case id column.

  • activity_column (str) –

    Column name of activity column.

  • timestamp_column (str) –

    Column name of timestamp column.

  • sorting_column (typing.Optional[str]) –

    Column name of sorting column.

  • case_table_id (typing.Optional[str]) –

    Id of case table.

  • **kwargs (typing.Any) –

    Additional parameters set for DataModelConfiguration object.

Returns:

get_process_configuration

get_process_configuration(id_)

Gets process configuration with given id.

Parameters:

  • id_ (str) –

    Id of process configuration.

Returns:

Raises:

get_process_configurations

get_process_configurations()

Gets all process configurations of given data model.

Returns: