Skip to content

Commit

Permalink
Merge pull request #2684 from fishtown-analytics/feature/dispatch-sch…
Browse files Browse the repository at this point in the history
…ema-tests

convert tests
  • Loading branch information
beckjake authored Aug 5, 2020
2 parents 36fda28 + 04f840d commit e641ec1
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

### Features
- Added a `dispatch` method to the context adapter and deprecated `adapter_macro`. ([#2302](https://github.com/fishtown-analytics/dbt/issues/2302), [#2679](https://github.com/fishtown-analytics/dbt/pull/2679))
- The built-in schema tests now use `adapter.dispatch`, so they can be overridden for adapter plugins ([#2415](https://github.com/fishtown-analytics/dbt/issues/2415), [#2684](https://github.com/fishtown-analytics/dbt/pull/2684))

Contributors:
- [@bbhoss](https://github.com/bbhoss) ([#2677](https://github.com/fishtown-analytics/dbt/pull/2677))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

{% macro test_accepted_values(model, values) %}
{% macro default__test_accepted_values(model, values) %}

{% set column_name = kwargs.get('column_name', kwargs.get('field')) %}
{% set quote_values = kwargs.get('quote', True) %}
Expand Down Expand Up @@ -35,3 +35,9 @@ select count(*) as validation_errors
from validation_errors

{% endmacro %}


{% macro test_accepted_values(model, values) %}
{% set macro = adapter.dispatch('test_accepted_values') %}
{{ macro(model, values, **kwargs) }}
{% endmacro %}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

{% macro test_not_null(model) %}
{% macro default__test_not_null(model) %}

{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}

Expand All @@ -9,3 +9,9 @@ where {{ column_name }} is null

{% endmacro %}



{% macro test_not_null(model) %}
{% set macro = adapter.dispatch('test_not_null') %}
{{ macro(model, **kwargs) }}
{% endmacro %}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

{% macro test_relationships(model, to, field) %}
{% macro default__test_relationships(model, to, field) %}

{% set column_name = kwargs.get('column_name', kwargs.get('from')) %}

Expand All @@ -16,3 +16,9 @@ where child.id is not null

{% endmacro %}



{% macro test_relationships(model, to, field) %}
{% set macro = adapter.dispatch('test_relationships') %}
{{ macro(model, to, field, **kwargs) }}
{% endmacro %}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

{% macro test_unique(model) %}
{% macro default__test_unique(model) %}

{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}

Expand All @@ -17,3 +17,9 @@ from (
) validation_errors

{% endmacro %}


{% macro test_unique(model) %}
{% set macro = adapter.dispatch('test_unique') %}
{{ macro(model, **kwargs) }}
{% endmacro %}

0 comments on commit e641ec1

Please sign in to comment.