Skip to content

foreign_key

Module to interact with foreign keys.

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

Typical usage example:

```python
foreign_key = data_model.get_foreign_key(foreign_key_id)
foreign_key.name = "NEW_NAME"
foreign_key.update()
foreign_key.reload()
foreign_key.delete()
```

ForeignKey

Bases: DataModelForeignKeyTransport

Foreign key object to interact with foreign key specific data integration endpoints.

client class-attribute instance-attribute

client = Field(..., exclude=True)

id instance-attribute

id

Id of foreign key.

data_pool_id instance-attribute

data_pool_id

Id of data pool where foreign key is located.

data_model_id instance-attribute

data_model_id

Id of data model where foreign key is located.

source_table_id instance-attribute

source_table_id

Id of source data model table.

target_table_id instance-attribute

target_table_id

Id of target data model table.

columns instance-attribute

columns

Columns of foreign key.

from_transport classmethod

from_transport(client, data_pool_id, foreign_key_transport)

Creates high-level foreign key object from given DataModelForeignKeyTransport.

Parameters:

  • client (Client) –

    Client to use to make API calls for given foreign key.

  • data_pool_id (str) –

    Id of data pool where table is located

  • foreign_key_transport (DataModelForeignKeyTransport) –

    DataModelForeignKeyTransport object containing properties of foreign key.

Returns:

  • ForeignKey

    A ForeignKey object with properties from transport and given client.

update

update()

Pushes local changes of foreign key to EMS and updates properties with response from EMS.

sync

sync()

Syncs foreign key properties with EMS.

delete

delete()

Deletes foreign key.