Skip to content

Commit

Permalink
fix support for dbt v1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
psousa50 committed Aug 8, 2022
1 parent 0dd83b7 commit 1733bdb
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions macros/utils.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,10 @@
{% endmacro %}

{% macro render_node(node) %}
{% set sql = node.raw_sql if dbt_unit_testing.version_in_group("1.2.0") else node.raw_code %}
{% set sql = node.raw_sql if node.raw_sql is defined else node.raw_code %}
{{ return (render(sql)) }}
{% endmacro %}

{% macro version_in_group(version_group_identifier) %}
{% set version_groups = [["1.1.0", "1.2.0"], ["1.3.0b1"]] %}
{% set group_indexes = {"i1": -1, "i2": -1} %}
{% for version_group in version_groups %}
{% if dbt_version in version_group %}
{% do group_indexes.update({"i1": loop.index}) %}
{% endif %}
{% if version_group_identifier in version_group %}
{% do group_indexes.update({"i2": loop.index}) %}
{% endif %}
{% endfor %}
{{ return (group_indexes.i1 == group_indexes.i2) }}
{% endmacro %}

{% macro extract_columns_list(query) %}
{% set results = dbt_unit_testing.run_query(query) %}
{% set columns = results.columns | map(attribute='name') | list %}
Expand Down

0 comments on commit 1733bdb

Please sign in to comment.