diepvries.deserializers.snowflake_deserializer module

Deserializer for Snowflake.

class diepvries.deserializers.snowflake_deserializer.DatabaseConfiguration(database, user, warehouse, account, password=None, authenticator='SNOWFLAKE')

Bases: object

Needed fields to create a Snowflake database connection.

__post_init__()

Validate input for optional attributes.

account: str
authenticator: Optional[str] = 'SNOWFLAKE'
database: str
password: Optional[str] = None
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.

Returns:

List of deserialized target tables.