-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test_various_configs.py and data
- Loading branch information
Showing
3 changed files
with
511 additions
and
0 deletions.
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
82
dbt-tests-adapter/dbt/tests/adapter/simple_snapshot/data/seed_cn.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
create table {database}.{schema}.seed ( | ||
id INTEGER, | ||
first_name VARCHAR(50), | ||
last_name VARCHAR(50), | ||
email VARCHAR(50), | ||
gender VARCHAR(50), | ||
ip_address VARCHAR(20), | ||
updated_at TIMESTAMP WITHOUT TIME ZONE | ||
); | ||
|
||
create table {database}.{schema}.snapshot_expected ( | ||
id INTEGER, | ||
first_name VARCHAR(50), | ||
last_name VARCHAR(50), | ||
email VARCHAR(50), | ||
gender VARCHAR(50), | ||
ip_address VARCHAR(20), | ||
|
||
-- snapshotting fields | ||
updated_at TIMESTAMP WITHOUT TIME ZONE, | ||
test_valid_from TIMESTAMP WITHOUT TIME ZONE, | ||
test_valid_to TIMESTAMP WITHOUT TIME ZONE, | ||
test_scd_id TEXT, | ||
test_updated_at TIMESTAMP WITHOUT TIME ZONE | ||
); | ||
|
||
|
||
-- 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 | ||
(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'), | ||
(4, 'Ralph', 'Turner', '[email protected]', 'Male', '157.83.76.114', '2016-08-08 00:06:51'), | ||
(5, 'Laura', 'Gonzales', '[email protected]', 'Female', '30.54.105.168', '2016-09-01 08:25:38'), | ||
(6, 'Katherine', 'Lopez', '[email protected]', 'Female', '169.138.46.89', '2016-08-30 18:52:11'), | ||
(7, 'Jeremy', 'Hamilton', '[email protected]', 'Male', '231.189.13.133', '2016-07-17 02:09:46'), | ||
(8, 'Heather', 'Rose', '[email protected]', 'Female', '87.165.201.65', '2015-12-29 22:03:56'), | ||
(9, 'Gregory', 'Kelly', '[email protected]', 'Male', '154.209.99.7', '2016-03-24 21:18:16'), | ||
(10, 'Rachel', 'Lopez', '[email protected]', 'Female', '237.165.82.71', '2016-08-20 15:44:49'), | ||
(11, 'Donna', 'Welch', '[email protected]', 'Female', '103.33.110.138', '2016-02-27 01:41:48'), | ||
(12, 'Russell', 'Lawrence', '[email protected]', 'Male', '189.115.73.4', '2016-06-11 03:07:09'), | ||
(13, 'Michelle', 'Montgomery', '[email protected]', 'Female', '243.220.95.82', '2016-06-18 16:27:19'), | ||
(14, 'Walter', 'Castillo', '[email protected]', 'Male', '71.159.238.196', '2016-10-06 01:55:44'), | ||
(15, 'Robin', 'Mills', '[email protected]', 'Female', '172.190.5.50', '2016-10-31 11:41:21'), | ||
(16, 'Raymond', 'Holmes', '[email protected]', 'Male', '148.153.166.95', '2016-10-03 08:16:38'), | ||
(17, 'Gary', 'Bishop', '[email protected]', 'Male', '161.108.182.13', '2016-08-29 19:35:20'), | ||
(18, 'Anna', 'Riley', '[email protected]', 'Female', '253.31.108.22', '2015-12-11 04:34:27'), | ||
(19, 'Sarah', 'Knight', '[email protected]', 'Female', '222.220.3.177', '2016-09-26 00:49:06'), | ||
(20, 'Phyllis', 'Fox', null, 'Female', '163.191.232.95', '2016-08-21 10:35:19'); | ||
|
||
|
||
-- populate snapshot table | ||
insert into {database}.{schema}.snapshot_expected ( | ||
id, | ||
first_name, | ||
last_name, | ||
email, | ||
gender, | ||
ip_address, | ||
updated_at, | ||
test_valid_from, | ||
test_valid_to, | ||
test_updated_at, | ||
test_scd_id | ||
) | ||
|
||
select | ||
id, | ||
first_name, | ||
last_name, | ||
email, | ||
gender, | ||
ip_address, | ||
updated_at, | ||
-- fields added by snapshotting | ||
updated_at as test_valid_from, | ||
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; |
82 changes: 82 additions & 0 deletions
82
dbt-tests-adapter/dbt/tests/adapter/simple_snapshot/data/seed_dbt_valid_to.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
create table {database}.{schema}.seed ( | ||
id INTEGER, | ||
first_name VARCHAR(50), | ||
last_name VARCHAR(50), | ||
email VARCHAR(50), | ||
gender VARCHAR(50), | ||
ip_address VARCHAR(20), | ||
updated_at TIMESTAMP WITHOUT TIME ZONE | ||
); | ||
|
||
create table {database}.{schema}.snapshot_expected ( | ||
id INTEGER, | ||
first_name VARCHAR(50), | ||
last_name VARCHAR(50), | ||
email VARCHAR(50), | ||
gender VARCHAR(50), | ||
ip_address VARCHAR(20), | ||
|
||
-- snapshotting fields | ||
updated_at TIMESTAMP WITHOUT TIME ZONE, | ||
test_valid_from TIMESTAMP WITHOUT TIME ZONE, | ||
test_valid_to TIMESTAMP WITHOUT TIME ZONE, | ||
test_scd_id TEXT, | ||
test_updated_at TIMESTAMP WITHOUT TIME ZONE | ||
); | ||
|
||
|
||
-- 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 | ||
(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'), | ||
(4, 'Ralph', 'Turner', '[email protected]', 'Male', '157.83.76.114', '2016-08-08 00:06:51'), | ||
(5, 'Laura', 'Gonzales', '[email protected]', 'Female', '30.54.105.168', '2016-09-01 08:25:38'), | ||
(6, 'Katherine', 'Lopez', '[email protected]', 'Female', '169.138.46.89', '2016-08-30 18:52:11'), | ||
(7, 'Jeremy', 'Hamilton', '[email protected]', 'Male', '231.189.13.133', '2016-07-17 02:09:46'), | ||
(8, 'Heather', 'Rose', '[email protected]', 'Female', '87.165.201.65', '2015-12-29 22:03:56'), | ||
(9, 'Gregory', 'Kelly', '[email protected]', 'Male', '154.209.99.7', '2016-03-24 21:18:16'), | ||
(10, 'Rachel', 'Lopez', '[email protected]', 'Female', '237.165.82.71', '2016-08-20 15:44:49'), | ||
(11, 'Donna', 'Welch', '[email protected]', 'Female', '103.33.110.138', '2016-02-27 01:41:48'), | ||
(12, 'Russell', 'Lawrence', '[email protected]', 'Male', '189.115.73.4', '2016-06-11 03:07:09'), | ||
(13, 'Michelle', 'Montgomery', '[email protected]', 'Female', '243.220.95.82', '2016-06-18 16:27:19'), | ||
(14, 'Walter', 'Castillo', '[email protected]', 'Male', '71.159.238.196', '2016-10-06 01:55:44'), | ||
(15, 'Robin', 'Mills', '[email protected]', 'Female', '172.190.5.50', '2016-10-31 11:41:21'), | ||
(16, 'Raymond', 'Holmes', '[email protected]', 'Male', '148.153.166.95', '2016-10-03 08:16:38'), | ||
(17, 'Gary', 'Bishop', '[email protected]', 'Male', '161.108.182.13', '2016-08-29 19:35:20'), | ||
(18, 'Anna', 'Riley', '[email protected]', 'Female', '253.31.108.22', '2015-12-11 04:34:27'), | ||
(19, 'Sarah', 'Knight', '[email protected]', 'Female', '222.220.3.177', '2016-09-26 00:49:06'), | ||
(20, 'Phyllis', 'Fox', null, 'Female', '163.191.232.95', '2016-08-21 10:35:19'); | ||
|
||
|
||
-- populate snapshot table | ||
insert into {database}.{schema}.snapshot_expected ( | ||
id, | ||
first_name, | ||
last_name, | ||
email, | ||
gender, | ||
ip_address, | ||
updated_at, | ||
test_valid_from, | ||
test_valid_to, | ||
test_updated_at, | ||
test_scd_id | ||
) | ||
|
||
select | ||
id, | ||
first_name, | ||
last_name, | ||
email, | ||
gender, | ||
ip_address, | ||
updated_at, | ||
-- fields added by snapshotting | ||
updated_at as test_valid_from, | ||
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; |
Oops, something went wrong.