Skip to content

Commit

Permalink
convert tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Beck committed Aug 4, 2020
1 parent dd764b9 commit 04f840d
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 @@ -6,6 +6,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))

## dbt 0.18.0b2 (July 30, 2020)

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 04f840d

Please sign in to comment.