-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix var precedence from cli, add tests (#739)
* fix var precedence from cli, add tests * updated from PR
- Loading branch information
Showing
6 changed files
with
87 additions
and
11 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
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,6 @@ | ||
|
||
test_vars: | ||
constraints: | ||
accepted_values: | ||
- {field: 'field', values: ['override']} | ||
|
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,3 @@ | ||
|
||
|
||
select '{{ var("required") }}'::varchar as field |
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,63 @@ | ||
from nose.plugins.attrib import attr | ||
from test.integration.base import DBTIntegrationTest | ||
import yaml | ||
|
||
|
||
class TestCLIVarOverride(DBTIntegrationTest): | ||
@property | ||
def schema(self): | ||
return "cli_vars_028" | ||
|
||
@property | ||
def models(self): | ||
return "test/integration/028_cli_vars/models_override" | ||
|
||
@property | ||
def project_config(self): | ||
return { | ||
"models": { | ||
"vars": { | ||
"required": "present" | ||
} | ||
} | ||
} | ||
|
||
@attr(type='postgres') | ||
def test__overriden_vars_global(self): | ||
self.use_default_project() | ||
self.use_profile('postgres') | ||
|
||
# This should be "override" | ||
self.run_dbt(["run", "--vars", "{required: override}"]) | ||
self.run_dbt(["test"]) | ||
|
||
|
||
class TestCLIVarOverridePorject(DBTIntegrationTest): | ||
@property | ||
def schema(self): | ||
return "cli_vars_028" | ||
|
||
@property | ||
def models(self): | ||
return "test/integration/028_cli_vars/models_override" | ||
|
||
@property | ||
def project_config(self): | ||
return { | ||
"models": { | ||
"test": { | ||
"vars": { | ||
"required": "present" | ||
} | ||
} | ||
} | ||
} | ||
|
||
@attr(type='postgres') | ||
def test__overriden_vars_project_level(self): | ||
self.use_default_project() | ||
self.use_profile('postgres') | ||
|
||
# This should be "override" | ||
self.run_dbt(["run", "--vars", "{required: override}"]) | ||
self.run_dbt(["test"]) |
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