Skip to content

Commit

Permalink
Remove {database} from sql for spark compat
Browse files Browse the repository at this point in the history
  • Loading branch information
gshank committed Oct 10, 2024
1 parent f20c7c5 commit e0a904c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions dbt-tests-adapter/dbt/tests/adapter/simple_snapshot/fixtures.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
create_seed_sql = """
create table {database}.{schema}.seed (
create table {schema}.seed (
id INTEGER,
first_name VARCHAR(50),
last_name VARCHAR(50),
Expand All @@ -11,7 +11,7 @@
"""

create_snapshot_expected_sql = """
create table {database}.{schema}.snapshot_expected (
create table {schema}.snapshot_expected (
id INTEGER,
first_name VARCHAR(50),
last_name VARCHAR(50),
Expand All @@ -33,7 +33,7 @@
-- seed inserts
-- use the same email for two users to verify that duplicated check_cols values
-- are handled appropriately
insert into {database}.{schema}.seed (id, first_name, last_name, email, gender, ip_address, updated_at) values
insert into {schema}.seed (id, first_name, last_name, email, gender, ip_address, updated_at) values
(1, 'Judith', 'Kennedy', '(not provided)', 'Female', '54.60.24.128', '2015-12-24 12:19:28'),
(2, 'Arthur', 'Kelly', '(not provided)', 'Male', '62.56.24.215', '2015-10-28 16:22:15'),
(3, 'Rachel', 'Moreno', '[email protected]', 'Female', '31.222.249.23', '2016-04-05 02:05:30'),
Expand All @@ -59,7 +59,7 @@

populate_snapshot_expected_sql = """
-- populate snapshot table
insert into {database}.{schema}.snapshot_expected (
insert into {schema}.snapshot_expected (
id,
first_name,
last_name,
Expand All @@ -86,12 +86,12 @@
null::timestamp as test_valid_to,
updated_at as test_updated_at,
md5(id || '-' || first_name || '|' || updated_at::text) as test_scd_id
from {database}.{schema}.seed;
from {schema}.seed;
"""

populate_snapshot_expected_valid_to_current_sql = """
-- populate snapshot table
insert into {database}.{schema}.snapshot_expected (
insert into {schema}.snapshot_expected (
id,
first_name,
last_name,
Expand All @@ -118,5 +118,5 @@
date('2099-12-31') as test_valid_to,
updated_at as test_updated_at,
md5(id || '-' || first_name || '|' || updated_at::text) as test_scd_id
from {database}.{schema}.seed;
from {schema}.seed;
"""
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
update_sql = """
-- insert v2 of the 11 - 21 records
insert into {database}.{schema}.snapshot_expected (
insert into {schema}.snapshot_expected (
id,
first_name,
last_name,
Expand All @@ -104,7 +104,7 @@
null::timestamp as test_valid_to,
updated_at as test_updated_at,
md5(id || '-' || first_name || '|' || updated_at::text) as test_scd_id
from {database}.{schema}.seed
from {schema}.seed
where id >= 10 and id <= 20;
"""

Expand Down Expand Up @@ -281,7 +281,7 @@ class TestSnapshotInvalidColumnNames(BaseSnapshotInvalidColumnNames):
update_with_current_sql = """
-- insert v2 of the 11 - 21 records
insert into {database}.{schema}.snapshot_expected (
insert into {schema}.snapshot_expected (
id,
first_name,
last_name,
Expand All @@ -308,7 +308,7 @@ class TestSnapshotInvalidColumnNames(BaseSnapshotInvalidColumnNames):
date('2099-12-31') as test_valid_to,
updated_at as test_updated_at,
md5(id || '-' || first_name || '|' || updated_at::text) as test_scd_id
from {database}.{schema}.seed
from {schema}.seed
where id >= 10 and id <= 20;
"""

Expand Down Expand Up @@ -337,7 +337,7 @@ def test_valid_to_current(self, project):

original_snapshot = run_sql_with_adapter(
project.adapter,
"select id, test_scd_id, test_valid_to from {database}.{schema}.snapshot_actual",
"select id, test_scd_id, test_valid_to from {schema}.snapshot_actual",
"all",
)
assert original_snapshot[0][2] == datetime.datetime(2099, 12, 31, 0, 0)
Expand All @@ -351,7 +351,7 @@ def test_valid_to_current(self, project):

updated_snapshot = run_sql_with_adapter(
project.adapter,
"select id, test_scd_id, test_valid_to from {database}.{schema}.snapshot_actual",
"select id, test_scd_id, test_valid_to from {schema}.snapshot_actual",
"all",
)
assert updated_snapshot[0][2] == datetime.datetime(2099, 12, 31, 0, 0)
Expand Down

0 comments on commit e0a904c

Please sign in to comment.