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_bronzeDataFrame - The input DataFrame containing the source data to be processed and loaded into the bronze history table.table_configTableConfig - Configuration object for the target table, containing metadata such as key columns, history settings, table name, and other relevant configurations.config_managerConfigManager - 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_sourceDataFrame - The delivery to compare with the history table.table_configTableConfig - Configuration of the object; supplies the key columns, the history table and the column that flags a deleted row.config_managerConfigManager - Global configuration manager.layerstr - The layer whose history table is loaded,bronzeorsilver.source_filter_querystr | None - Query that scopes which delivered rows enter the history.delete_filter_querystr | None - Query that scopes which history rows the delete detection looks at.skip_deletebool - When true, no delete rows are written at all.key_violation_actionstr | None - Action on duplicate keys in the delivery.full_deliverybool - When true, a key that is missing from the delivery counts as deleted. When false, deletes only come fromdelete_filter_queryor the deleted-identifier column.
Raises:
Exception- Raised if history is not enabled for the object or the history table cannot be loaded.