Skip to main content

easyfabric.loaders.history

load_dataframe_bronze_history​

def load_dataframe_bronze_history(
df_bronze: DataFrame,
table_config: TableConfig,
config_manager: ConfigManager = None) -> None

Loads the given DataFrame into the bronze history table: new and changed rows are appended, keys that left the source get a row with a negative SYSTEMSTATETIMESTAMP. The compare and delete logic lives in :func:load_dataframe_history; this function resolves the bronze history settings of the object.

Arguments:

  • df_bronze DataFrame - The input DataFrame containing the source data to be processed and loaded into the bronze history table.
  • table_config TableConfig - Configuration object for the target table, containing metadata such as key columns, history settings, table name, and other relevant configurations.
  • config_manager ConfigManager - Configuration manager providing access to global configurations, such as lakehouseA place where you store both "raw" data (like files) and "organized" data (like tables). It combines the best of a File Cabinet and a Database. settings, paths, schemas, and other metadata for processing.

Raises:

  • Exception - Raised if the bronze lakehouse cannot be retrieved, history settings are invalid, history functionality is not enabled for the table, or other critical configurations are missing that halt processing.

load_dataframe_history​

def load_dataframe_history(df_source: DataFrame,
table_config: TableConfig,
config_manager: ConfigManager = None,
*,
layer: str,
source_filter_query: str | None = None,
delete_filter_query: str | None = None,
skip_delete: bool = False,
key_violation_action: str | None = None,
full_delivery: bool = True) -> None

Appends the difference between a delivery and the history table of one layer to that history table.

The delivery is compared with the current row per key in the history table. New and changed rows are appended with a positive SYSTEMSTATETIMESTAMP, rows that left the source with a negative one. The history table is only ever appended to. Bronze.his and Silver.his are both loaded through this function.

Arguments:

  • df_source DataFrame - The delivery to compare with the history table.
  • table_config TableConfig - Configuration of the object; supplies the key columns, the history table and the column that flags a deleted row.
  • config_manager ConfigManager - Global configuration manager.
  • layer str - The layer whose history table is loaded, bronze or silver.
  • source_filter_query str | None - Query that scopes which delivered rows enter the history.
  • delete_filter_query str | None - Query that scopes which history rows the delete detection looks at.
  • skip_delete bool - When true, no delete rows are written at all.
  • key_violation_action str | None - Action on duplicate keys in the delivery.
  • full_delivery bool - When true, a key that is missing from the delivery counts as deleted. When false, deletes only come from delete_filter_query or the deleted-identifier column.

Raises:

  • Exception - Raised if history is not enabled for the object or the history table cannot be loaded.