Skip to content

table_push_manager.py

TablePushManager

Table Push Manager object to interact with Celonis Event Collection API.

Parameters:

Name Type Description Default
pool_table_name str

Name of Table.

required
if_exists str
  • error -> an error is thrown if a table of the same name already exists in the pool.
  • drop -> the existing able is dropped completely and a new table is created, by default error.
  • replace_data_only -> the column names and types of the old tables are not overwritten.
required
primary_keys List[str]

List of Table primary keys.

None
column_config List[Dict]

Can be used to specify column types and string field length.

    [
        {
            "columnName":"BUKRS",
            "fieldLength":100,
            "columnType":"STRING"
        }...
    ]
with columnType one of [INTEGER, DATE, TIME, DATETIME, FLOAT, BOOLEAN, STRING].

None
alias str

Alias of the Table.

None
foreign_keys List[Tuple[str, str]]

Foreign keys to connect pool_table_name to either source_table or target_table in Datamodel.

None
source_table str

If given, the join created will be pool_table_name: N (parent) <-> (child) 1 :source_table

None
target_table str

If given, the join created will be target_table: N (parent) <-> (child) 1 :pool_table_name

None
partial_reload_on_execution bool

If True, Datamodel will be partially reloaded after each push.

False

get_existing_table_status(self, datamodel)

Checks the Status of an existing Table in Event Collection."

Status Dictionary:

{
    "pool_table_exists": True,
    "dm_table_exists": True,
    "foreign_keys": [("KEY","KEY"),...],
    "table_cols": ["KEY","ACTIVITY_EN",..]
}

Parameters:

Name Type Description Default
datamodel Datamodel

Datamodel the the table is supposed to be added to.

required

Returns:

Type Description
Dict

Status Dictionary.

create_table(self, df, datamodel, partial_reload=False)

Creates the Table by pushing it to the Pool, adding it to the Datamodel and creating the Foreign Key.

Parameters:

Name Type Description Default
df DataFrame

Table to be pushed.

required
datamodel Datamodel

Target Datamodel

required
partial_reload bool

If True Datamodel is partially reloaded after Table is added.

False

Returns:

Type Description
DatamodelTable

The newly created Datamodel Table.

push_data_into_table(self, df, datamodel)

Executes the data push manager with the given df.

Parameters:

Name Type Description Default
df pd.DataFrame required
datamodel DataModel required

Returns:

Type Description
str

"DONE"