-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/materialized-tests/adap-892
- Loading branch information
Showing
8 changed files
with
190 additions
and
6 deletions.
There are no files selected for viewing
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,7 @@ | ||
kind: Features | ||
body: Support partition_by and cluster_by on python models when supplied in model | ||
configurations | ||
time: 2023-04-26T15:25:26.285021+09:00 | ||
custom: | ||
Author: kalanyuz | ||
Issue: "680" |
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,6 @@ | ||
kind: Fixes | ||
body: Avoid setting lifetime on impersonation tokens. | ||
time: 2023-08-17T09:55:27.333914673-04:00 | ||
custom: | ||
Author: cmc333333 | ||
Issue: "769" |
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,6 @@ | ||
kind: Fixes | ||
body: Fix bigquery copy materialization | ||
time: 2023-09-06T14:18:19.445262+02:00 | ||
custom: | ||
Author: m-sche | ||
Issue: "820" |
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
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
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
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,62 @@ | ||
import pytest | ||
from pathlib import Path | ||
from dbt.tests.util import run_dbt, write_file, check_relations_equal | ||
|
||
_SEED_A = """ | ||
load_date,id,first_name,last_name,email,gender,ip_address | ||
2021-03-05,1,Jack,Hunter,jhunter0@pbs.org,Male,59.80.20.168 | ||
2021-03-05,2,Kathryn,Walker,kwalker1@ezinearticles.com,Female,194.121.179.35 | ||
2021-03-05,3,Gerald,Ryan,gryan2@com.com,Male,11.3.212.243 | ||
""".lstrip() | ||
|
||
_SEED_B = """ | ||
load_date,id,first_name,last_name,email,gender,ip_address | ||
2021-03-05,4,Bonnie,Spencer,bspencer3@ameblo.jp,Female,216.32.196.175 | ||
2021-03-05,5,Harold,Taylor,htaylor4@people.com.cn,Male,253.10.246.136 | ||
""".lstrip() | ||
|
||
_EXPECTED_RESULT = """ | ||
load_date,id,first_name,last_name,email,gender,ip_address | ||
2021-03-05,1,Jack,Hunter,jhunter0@pbs.org,Male,59.80.20.168 | ||
2021-03-05,2,Kathryn,Walker,kwalker1@ezinearticles.com,Female,194.121.179.35 | ||
2021-03-05,3,Gerald,Ryan,gryan2@com.com,Male,11.3.212.243 | ||
2021-03-05,4,Bonnie,Spencer,bspencer3@ameblo.jp,Female,216.32.196.175 | ||
2021-03-05,5,Harold,Taylor,htaylor4@people.com.cn,Male,253.10.246.136 | ||
""".lstrip() | ||
|
||
_COPY_MODEL = """ | ||
{{ config( | ||
materialized="copy", | ||
copy_materialization="incremental", | ||
) }} | ||
SELECT * FROM {{ ref("seed") }} | ||
""" | ||
|
||
|
||
class BaseCopyModelConfig: | ||
@pytest.fixture(scope="class") | ||
def models(self): | ||
return {"copy_model.sql": _COPY_MODEL} | ||
|
||
@pytest.fixture(scope="class") | ||
def seeds(self): | ||
return { | ||
"seed.csv": _SEED_A, | ||
"expected_result.csv": _EXPECTED_RESULT, | ||
} | ||
|
||
|
||
class TestCopyMaterialization(BaseCopyModelConfig): | ||
def test_incremental_copy(self, project): | ||
run_dbt(["seed"]) | ||
run_dbt(["run"]) | ||
|
||
# Replace original seed _SEED_A with _SEED_B | ||
seed_file = project.project_root / Path("seeds") / Path("seed.csv") | ||
write_file(_SEED_B, seed_file) | ||
|
||
run_dbt(["seed"]) | ||
run_dbt(["run"]) | ||
|
||
check_relations_equal(project.adapter, ["copy_model", "expected_result"]) |
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