-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Refactor query tag tests * Try this * Try storing failures, too * Keep trying * Try it this way
- Loading branch information
Showing
10 changed files
with
68 additions
and
93 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,10 @@ | ||
{% macro check_query_tag() %} | ||
|
||
{% if execute %} | ||
{% set query_tag = get_current_query_tag() %} | ||
{% if query_tag != var("query_tag") %} | ||
{{ exceptions.raise_compiler_error("Query tag not used!") }} | ||
{% endif %} | ||
{% endif %} | ||
|
||
{% endmacro %} |
3 changes: 3 additions & 0 deletions
3
tests/integration/query_tag_tests/models/incremental_model_query_tag.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,3 @@ | ||
{{ config(materialized = 'incremental', unique_key = 'id') }} | ||
|
||
select 1 as id |
3 changes: 3 additions & 0 deletions
3
tests/integration/query_tag_tests/models/table_model_query_tag.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,3 @@ | ||
{{ config(materialized = 'table') }} | ||
|
||
select 1 as id |
3 changes: 3 additions & 0 deletions
3
tests/integration/query_tag_tests/models/view_model_query_tag.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,3 @@ | ||
{{ config(materialized = 'view') }} | ||
|
||
select 1 as id |
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,2 @@ | ||
id | ||
1 |
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,46 @@ | ||
import os | ||
import csv | ||
from tests.integration.base import DBTIntegrationTest, use_profile | ||
|
||
class TestSeedWithQueryTag(DBTIntegrationTest): | ||
@property | ||
def schema(self): | ||
return "query_tag" | ||
|
||
@property | ||
def models(self): | ||
return "models" | ||
|
||
@property | ||
def project_config(self): | ||
return { | ||
'config-version': 2, | ||
'models': { | ||
'test': { | ||
'query_tag': self.prefix, | ||
'post-hook': '{{ check_query_tag() }}' | ||
}, | ||
}, | ||
'seeds': { | ||
'test': { | ||
'query_tag': self.prefix, | ||
'post-hook': '{{ check_query_tag() }}' | ||
}, | ||
}, | ||
'snapshots': { | ||
'test': { | ||
'query_tag': self.prefix, | ||
'post-hook': '{{ check_query_tag() }}' | ||
}, | ||
}, | ||
} | ||
|
||
def build_all_with_query_tags(self): | ||
self.run_dbt(['build', '--vars', '{{"query_tag": "{}"}}'.format(self.prefix)]) | ||
|
||
@use_profile('snowflake') | ||
def test__snowflake__build_tagged_twice(self): | ||
self.build_all_with_query_tags() | ||
self.build_all_with_query_tags() | ||
|
||
|
16 changes: 0 additions & 16 deletions
16
tests/integration/simple_seed_test/check-query-tag-expected/check_query_tag.sql
This file was deleted.
Oops, something went wrong.
41 changes: 0 additions & 41 deletions
41
tests/integration/simple_seed_test/test_seed_with_query_tag.py
This file was deleted.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
tests/integration/simple_snapshot_test/test_snapshot_query_tag.py
This file was deleted.
Oops, something went wrong.