Scalefree's dbt package for a Data Vault 2.0 implementation congruent to the original Data Vault 2.0 definition by Dan Linstedt including the Staging Area, DV2.0 main entities, PITs and Snapshot Tables.
In the generated code for control_snapshot_v0, the Is_daily flag is currently not correctly set to reflect the user's input for daily_snapshot_time - If this parameter is set to any timestamp other than 00:00:00.
Current macro:
CASE
WHEN EXTRACT(MINUTE FROM sdts) = 0 AND EXTRACT(SECOND FROM sdts) = 0 AND EXTRACT(HOUR FROM sdts) = 0 THEN TRUE
ELSE FALSE
END AS is_daily
Meaning, is_daily flag is only true, if daily snapshot definition is 00:00:00.
Proposal to change the macro code to parse user definition of daily snapshot:
CASE
WHEN
EXTRACT(HOUR FROM sdts) = EXTRACT(HOUR FROM TO_TIME('{{ daily_snapshot_time }}'))
AND EXTRACT(MINUTE FROM sdts) = EXTRACT(MINUTE FROM TO_TIME('{{ daily_snapshot_time }}'))
AND EXTRACT(SECOND FROM sdts) = EXTRACT(SECOND FROM TO_TIME('{{ daily_snapshot_time }}'))
THEN TRUE
ELSE FALSE
END AS is_daily
In the generated code for control_snapshot_v0, the Is_daily flag is currently not correctly set to reflect the user's input for daily_snapshot_time - If this parameter is set to any timestamp other than 00:00:00.
Current macro: CASE WHEN EXTRACT(MINUTE FROM sdts) = 0 AND EXTRACT(SECOND FROM sdts) = 0 AND EXTRACT(HOUR FROM sdts) = 0 THEN TRUE ELSE FALSE END AS is_daily
Meaning, is_daily flag is only true, if daily snapshot definition is 00:00:00.
Proposal to change the macro code to parse user definition of daily snapshot: CASE WHEN EXTRACT(HOUR FROM sdts) = EXTRACT(HOUR FROM TO_TIME('{{ daily_snapshot_time }}')) AND EXTRACT(MINUTE FROM sdts) = EXTRACT(MINUTE FROM TO_TIME('{{ daily_snapshot_time }}')) AND EXTRACT(SECOND FROM sdts) = EXTRACT(SECOND FROM TO_TIME('{{ daily_snapshot_time }}')) THEN TRUE ELSE FALSE END AS is_daily