-
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.
(fixes #311) Configure tags, and select them with --models
- Loading branch information
Showing
15 changed files
with
314 additions
and
55 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
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 |
---|---|---|
|
@@ -34,6 +34,7 @@ | |
'column_types', | ||
'bind', | ||
'quoting', | ||
'tags', | ||
] | ||
|
||
|
||
|
3 changes: 2 additions & 1 deletion
3
test/integration/007_graph_selection_tests/models/base_users.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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
|
||
{{ | ||
config( | ||
materialized = 'ephemeral' | ||
materialized = 'ephemeral', | ||
tags = ['base'] | ||
) | ||
}} | ||
|
||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
|
||
{{ | ||
config(materialized='ephemeral') | ||
config(materialized='ephemeral', tags=['base']) | ||
}} | ||
|
||
select distinct email from {{ ref('base_users') }} |
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
|
||
{{ | ||
config( | ||
materialized = 'table' | ||
materialized = 'table', | ||
tags='bi' | ||
) | ||
}} | ||
|
||
|
3 changes: 2 additions & 1 deletion
3
test/integration/007_graph_selection_tests/models/users_rollup.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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
|
||
{{ | ||
config( | ||
materialized = 'view' | ||
materialized = 'view', | ||
tags = ['bi'] | ||
) | ||
}} | ||
|
||
|
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
63 changes: 63 additions & 0 deletions
63
test/integration/007_graph_selection_tests/test_tag_selection.py
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 test.integration.base import DBTIntegrationTest, use_profile | ||
|
||
class TestGraphSelection(DBTIntegrationTest): | ||
|
||
@property | ||
def schema(self): | ||
return "graph_selection_tests_007" | ||
|
||
@property | ||
def models(self): | ||
return "test/integration/007_graph_selection_tests/models" | ||
|
||
@property | ||
def project_config(self): | ||
return { | ||
"models": { | ||
"test": { | ||
"users": { | ||
"tags": "specified_as_string" | ||
}, | ||
|
||
"users_rollup": { | ||
"tags": ["specified_in_project"] | ||
} | ||
} | ||
} | ||
} | ||
|
||
@use_profile('postgres') | ||
def test__postgres__select_tag(self): | ||
self.run_sql_file("test/integration/007_graph_selection_tests/seed.sql") | ||
|
||
results = self.run_dbt(['run', '--models', 'tag:specified_as_string']) | ||
self.assertEqual(len(results), 1) | ||
|
||
models_run = [r.node['name'] for r in results] | ||
self.assertTrue('users' in models_run) | ||
|
||
|
||
@use_profile('postgres') | ||
def test__postgres__select_tag_and_children(self): | ||
self.run_sql_file("test/integration/007_graph_selection_tests/seed.sql") | ||
|
||
results = self.run_dbt(['run', '--models', '+tag:specified_in_project+']) | ||
self.assertEqual(len(results), 2) | ||
|
||
models_run = [r.node['name'] for r in results] | ||
self.assertTrue('users' in models_run) | ||
self.assertTrue('users_rollup' in models_run) | ||
|
||
|
||
# check that model configs aren't squashed by project configs | ||
@use_profile('postgres') | ||
def test__postgres__select_tag_in_model_with_project_Config(self): | ||
self.run_sql_file("test/integration/007_graph_selection_tests/seed.sql") | ||
|
||
results = self.run_dbt(['run', '--models', 'tag:bi']) | ||
self.assertEqual(len(results), 2) | ||
|
||
models_run = [r.node['name'] for r in results] | ||
self.assertTrue('users' in models_run) | ||
self.assertTrue('users_rollup' in models_run) | ||
|
Oops, something went wrong.