From 463324d6c93606a943697f277664fe2184e4519f Mon Sep 17 00:00:00 2001 From: Abdelkader Kouhli Date: Sat, 18 Dec 2021 10:47:37 +0100 Subject: [PATCH 1/2] Drop run and store behavior --- .../macros/materializations/snapshots/strategies.sql | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/core/dbt/include/global_project/macros/materializations/snapshots/strategies.sql b/core/dbt/include/global_project/macros/materializations/snapshots/strategies.sql index aeb2e09d965..a42e994d03a 100644 --- a/core/dbt/include/global_project/macros/materializations/snapshots/strategies.sql +++ b/core/dbt/include/global_project/macros/materializations/snapshots/strategies.sql @@ -132,17 +132,7 @@ {% set check_cols_config = config['check_cols'] %} {% set primary_key = config['unique_key'] %} {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %} - - {% set select_current_time -%} - select {{ snapshot_get_time() }} as snapshot_start - {%- endset %} - - {#-- don't access the column by name, to avoid dealing with casing issues on snowflake #} - {%- set now = run_query(select_current_time)[0][0] -%} - {% if now is none or now is undefined -%} - {%- do exceptions.raise_compiler_error('Could not get a snapshot start time from the database') -%} - {%- endif %} - {% set updated_at = config.get('updated_at', snapshot_string_as_time(now)) %} + {% set updated_at = snapshot_get_time() %} {% set column_added = false %} From afeb255c21d3ac94671d933613025d0abf8ea846 Mon Sep 17 00:00:00 2001 From: Abdelkader Kouhli Date: Mon, 14 Mar 2022 20:02:49 +0100 Subject: [PATCH 2/2] Add changie entry --- .changes/unreleased/Fixes-20220314-200236.yaml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changes/unreleased/Fixes-20220314-200236.yaml diff --git a/.changes/unreleased/Fixes-20220314-200236.yaml b/.changes/unreleased/Fixes-20220314-200236.yaml new file mode 100644 index 00000000000..65783acc3f5 --- /dev/null +++ b/.changes/unreleased/Fixes-20220314-200236.yaml @@ -0,0 +1,7 @@ +kind: Fixes +body: Inconsistent timestamps between inserted/updated and deleted rows in snapshots +time: 2022-03-14T20:02:36.119598832+01:00 +custom: + Author: kadero + Issue: "4347" + PR: "4513"