Skip to content

Commit

Permalink
Wrap queries in begin/end block for better Snowflake compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterallenwebb committed Dec 18, 2024
1 parent 0237724 commit 2163952
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from dbt.tests.util import check_relations_equal, run_dbt

_seed_new_record_mode = """
BEGIN
create table {database}.{schema}.seed (
id INTEGER,
first_name VARCHAR(50),
Expand Down Expand Up @@ -88,6 +90,8 @@
md5(id || '-' || first_name || '|' || updated_at::text) as dbt_scd_id,
'False' as dbt_is_deleted
from {database}.{schema}.seed;
END;
"""

_snapshot_actual_sql = """
Expand Down Expand Up @@ -119,6 +123,8 @@


_invalidate_sql = """
BEGIN
-- update records 11 - 21. Change email and updated_at field
update {schema}.seed set
updated_at = updated_at + interval '1 hour',
Expand All @@ -131,6 +137,7 @@
dbt_valid_to = updated_at + interval '1 hour'
where id >= 10 and id <= 20;
END;
"""

_update_sql = """
Expand Down

0 comments on commit 2163952

Please sign in to comment.