Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: not_null_proportion test deprecation warning and performance #416

Merged
merged 7 commits into from
Sep 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions macros/schema_tests/not_null_proportion.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% macro test_not_null_proportion(model) %}
{{ return(adapter.dispatch('test_not_null_proportion', packages = dbt_utils._get_utils_namespaces())(model, **kwargs)) }}
{{ return(adapter.dispatch('test_not_null_proportion', 'dbt_utils')(model, **kwargs)) }}
{% endmacro %}

{% macro default__test_not_null_proportion(model) %}
Expand All @@ -9,7 +9,7 @@
{% set at_most = kwargs.get('at_most', kwargs.get('arg', 1)) %}

with validation as (
select
select
sum(case when {{ column_name }} is null then 0 else 1 end) / cast(count(*) as numeric) as not_null_proportion
from {{ model }}
),
Expand All @@ -19,8 +19,8 @@ validation_errors as (
from validation
where not_null_proportion < {{ at_least }} or not_null_proportion > {{ at_most }}
)
select
count(*)
select
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

from validation_errors

{% endmacro %}