-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added test support for databases without boolean types (#4091)
* added support for dbs without boolean types * catch errors a bit better * moved changelog entry * fixed tests and updated exception * cleaned up bool check * added positive test, removed self ref
- Loading branch information
Showing
12 changed files
with
275 additions
and
1 deletion.
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
10 changes: 10 additions & 0 deletions
10
test/integration/008_schema_tests_test/macros-v2/override_get_test_macros/get_test_sql.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,10 @@ | ||
{% macro get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%} | ||
select | ||
{{ fail_calc }} as failures, | ||
case when {{ fail_calc }} {{ warn_if }} then 1 else 0 end as should_warn, | ||
case when {{ fail_calc }} {{ error_if }} then 1 else 0 end as should_error | ||
from ( | ||
{{ main_sql }} | ||
{{ "limit " ~ limit if limit != none }} | ||
) dbt_internal_test | ||
{%- endmacro %} |
10 changes: 10 additions & 0 deletions
10
...ntegration/008_schema_tests_test/macros-v2/override_get_test_macros_fail/get_test_sql.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,10 @@ | ||
{% macro get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%} | ||
select | ||
{{ fail_calc }} as failures, | ||
case when {{ fail_calc }} {{ warn_if }} then 'x' else 'y' end as should_warn, | ||
case when {{ fail_calc }} {{ error_if }} then 'x' else 'y' end as should_error | ||
from ( | ||
{{ main_sql }} | ||
{{ "limit " ~ limit if limit != none }} | ||
) dbt_internal_test | ||
{% endmacro %} |
3 changes: 3 additions & 0 deletions
3
...integration/008_schema_tests_test/models-v2/override_get_test_models/my_model_failure.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 @@ | ||
select * from {{ ref('my_model_pass') }} | ||
UNION ALL | ||
select null as id |
3 changes: 3 additions & 0 deletions
3
test/integration/008_schema_tests_test/models-v2/override_get_test_models/my_model_pass.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 @@ | ||
select 1 as id | ||
UNION ALL | ||
select null as id |
1 change: 1 addition & 0 deletions
1
...integration/008_schema_tests_test/models-v2/override_get_test_models/my_model_warning.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 @@ | ||
select * from {{ ref('my_model_pass') }} |
31 changes: 31 additions & 0 deletions
31
test/integration/008_schema_tests_test/models-v2/override_get_test_models/schema.yml
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,31 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: my_model_pass | ||
description: "The table has 1 null values, and we're okay with that, until it's more than 1." | ||
columns: | ||
- name: id | ||
description: "The number of responses for this favorite color - purple will be null" | ||
tests: | ||
- not_null: | ||
error_if: '>1' | ||
warn_if: '>1' | ||
|
||
- name: my_model_warning | ||
description: "The table has 1 null values, and we're okay with that, but let us know" | ||
columns: | ||
- name: id | ||
description: "The number of responses for this favorite color - purple will be null" | ||
tests: | ||
- not_null: | ||
error_if: '>1' | ||
|
||
- name: my_model_failure | ||
description: "The table has 2 null values, and we're not okay with that" | ||
columns: | ||
- name: id | ||
description: "The number of responses for this favorite color - purple will be null" | ||
tests: | ||
- not_null: | ||
error_if: '>1' | ||
|
3 changes: 3 additions & 0 deletions
3
test/integration/008_schema_tests_test/models-v2/override_get_test_models_fail/my_model.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 @@ | ||
select 1 as id | ||
UNION ALL | ||
select null as id |
12 changes: 12 additions & 0 deletions
12
test/integration/008_schema_tests_test/models-v2/override_get_test_models_fail/schema.yml
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,12 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: my_model | ||
description: "The table has 1 null values, and we're not okay with that." | ||
columns: | ||
- name: id | ||
description: "The number of responses for this favorite color - purple will be null" | ||
tests: | ||
- not_null | ||
|
||
|
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