diepvries.deserializers.snowflake_deserializer module

Deserializer for Snowflake.

class diepvries.deserializers.snowflake_deserializer.DatabaseConfiguration(database, user, password, warehouse, account)

Bases: object

Needed fields to create a Snowflake database connection.

account: str
database: str
password: str
user: str
warehouse: str
class diepvries.deserializers.snowflake_deserializer.SnowflakeDeserializer(target_schema, target_tables, database_configuration, driving_keys=None, role_playing_hubs=None)

Bases: object

Deserialize a Data Vault model, based on Snowflake system metadata tables.

The deserialization process will consist in converting the list of target table names to a list of Table instances.

Each Table will have a list of Field instances (representing database table columns).

__init__(target_schema, target_tables, database_configuration, driving_keys=None, role_playing_hubs=None)

Instantiate a SnowflakeDeserializer.

Besides setting __init__ arguments as class attributes, it also creates a Snowflake database connection.

Both target_tables and fields have their own setters (check @target_tables.setter and @fields.setter for more detail).

Parameters:
  • target_schema (str) – Schema where the Data Vault model is stored.

  • target_tables (List[str]) – Names of the tables that should be deserialized.

  • database_configuration (DatabaseConfiguration) – Holds all properties needed to create a Snowflake database connection.

  • driving_keys (Optional[List[DrivingKeyField]]) – List of fields that should be used as driving keys in current model’s effectivity satellites (if applicable).

  • role_playing_hubs (Optional[Dict[str, str]]) – List of tables that should be created as RolePlayingHub objects. Each dictionary has the role playing hub as key and the parent table as value.

__str__()

Representation of a SnowflakeDeserializer object as a string.

This helps the tracking of logging events per entity.

Return type:

str

Returns:

Logger string format.

property deserialized_target_tables: List[DataVaultTable]

Deserialize all target tables passed as argument during instance creation.

Return type:

List[DataVaultTable]

Returns:

List of deserialized target tables.