forked from dbt-labs/dbt-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use yaml renderer (with target context) for rendering selectors (dbt-…
…labs#5136) * Use yaml renderer (with target context) for rendering selectors * Changie * Convert cli_vars tests * Add test for var in profiles * Add test for cli vars in packages * Add test for vars in selectors
- Loading branch information
Showing
16 changed files
with
302 additions
and
192 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: Fixes | ||
body: Use yaml renderer (with target context) for rendering selectors | ||
time: 2022-04-22T13:56:45.147893-04:00 | ||
custom: | ||
Author: gshank | ||
Issue: "5131" | ||
PR: "5136" |
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
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
6 changes: 0 additions & 6 deletions
6
test/integration/028_cli_vars_tests/models_complex/complex_model.sql
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
test/integration/028_cli_vars_tests/models_complex/schema.yml
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
test/integration/028_cli_vars_tests/models_override/schema.yml
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
test/integration/028_cli_vars_tests/models_override/test_vars.sql
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
test/integration/028_cli_vars_tests/models_simple/simple_model.sql
This file was deleted.
Oops, something went wrong.
57 changes: 0 additions & 57 deletions
57
test/integration/028_cli_vars_tests/test_cli_var_override.py
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,68 @@ | ||
import pytest | ||
|
||
from dbt.tests.util import run_dbt | ||
|
||
|
||
models_override__schema_yml = """ | ||
version: 2 | ||
models: | ||
- name: test_vars | ||
columns: | ||
- name: field | ||
tests: | ||
- accepted_values: | ||
values: | ||
- override | ||
""" | ||
|
||
models_override__test_vars_sql = """ | ||
select '{{ var("required") }}'::varchar as field | ||
""" | ||
|
||
|
||
# Tests that cli vars override vars set in the project config | ||
class TestCLIVarOverride: | ||
@pytest.fixture(scope="class") | ||
def models(self): | ||
return { | ||
"schema.yml": models_override__schema_yml, | ||
"test_vars.sql": models_override__test_vars_sql, | ||
} | ||
|
||
@pytest.fixture(scope="class") | ||
def project_config_update(self): | ||
return { | ||
"vars": { | ||
"required": "present", | ||
}, | ||
} | ||
|
||
def test__override_vars_global(self, project): | ||
run_dbt(["run", "--vars", "{required: override}"]) | ||
run_dbt(["test"]) | ||
|
||
|
||
# This one switches to setting a var in 'test' | ||
class TestCLIVarOverridePorject: | ||
@pytest.fixture(scope="class") | ||
def models(self): | ||
return { | ||
"schema.yml": models_override__schema_yml, | ||
"test_vars.sql": models_override__test_vars_sql, | ||
} | ||
|
||
@pytest.fixture(scope="class") | ||
def project_config_update(self): | ||
return { | ||
"vars": { | ||
"test": { | ||
"required": "present", | ||
}, | ||
}, | ||
} | ||
|
||
def test__override_vars_project_level(self, project): | ||
|
||
# This should be "override" | ||
run_dbt(["run", "--vars", "{required: override}"]) | ||
run_dbt(["test"]) |
Oops, something went wrong.