Skip to content

Commit

Permalink
fix: not_null_proportion test deprecation warning and performance (#416)
Browse files Browse the repository at this point in the history
* fix to make not-null-proportion work as intended and remove decpration warning;

* fix for object type in excluded columns

* clean up namespace formatting

* fix to make not-null-proportion work as intended and remove decpration warning;

* remove  utils.star from separate change

* remove utils.star from unrelated change

Co-authored-by: Jason Ganx <[email protected]>
  • Loading branch information
jasnonaz and Jason Ganx authored Sep 17, 2021
1 parent fbe2167 commit b1f5271
Showing 1 changed file with 4 additions and 4 deletions.
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
*
from validation_errors

{% endmacro %}

0 comments on commit b1f5271

Please sign in to comment.