Skip to content

Commit

Permalink
Merge pull request #23 from calogica/fix/issue-22-datatype
Browse files Browse the repository at this point in the history
Refactor column type checks to use dtype
  • Loading branch information
clausherther authored Mar 4, 2021
2 parents 2b0d8e6 + d3fd1e6 commit 4670d4c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{%- set matching_column_types = [] -%}

{%- for column in columns_in_relation -%}
{%- if ((column.name | upper ) == column_name) and ((column.data_type | upper ) in column_type_list) -%}
{%- if ((column.name | upper ) == column_name) and ((column.dtype | upper ) in column_type_list) -%}
{%- do matching_column_types.append(column.name) -%}
{%- endif -%}
{%- endfor -%}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
{%- macro test_expect_column_values_to_be_of_type(model, column_name, column_type) -%}
{%- if execute -%}

{%- set column_name = column_name | upper -%}
{%- set columns_in_relation = adapter.get_columns_in_relation(model) -%}
{%- set column_type = column_type| upper -%}

{%- set matching_column_types = [] -%}

{%- for column in columns_in_relation -%}
{%- if ((column.name | upper ) == column_name) and ((column.data_type | upper ) == column_type) -%}
{%- do matching_column_types.append(column.name) -%}
{%- endif -%}
{%- endfor -%}
select 1 - {{ matching_column_types | length }}

{%- endif -%}
{{ dbt_expectations.test_expect_column_values_to_be_in_type_list(model, column_name, [column_type]) }}
{%- endmacro -%}

0 comments on commit 4670d4c

Please sign in to comment.