Skip to content

Commit

Permalink
Update to dbt 0.19.0 and dbt utils 0.6.4
Browse files Browse the repository at this point in the history
readme fix
  • Loading branch information
Alex Higgs committed Jan 28, 2021
1 parent 9ade996 commit 6d6c2db
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 13 deletions.
4 changes: 2 additions & 2 deletions dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 'dbtvault'
version: '0.7.2'
require-dbt-version: [">=0.18.0", "<0.19.0"]
version: '0.7.3'
require-dbt-version: [">=0.18.0", "<0.20.0"]
config-version: 2

source-paths: ["models"]
Expand Down
20 changes: 16 additions & 4 deletions macros/materialisations/vault_insert_by_period_materialization.sql
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,13 @@
);
{%- endcall %}

{%- set rows_inserted = (load_result(insert_query_name)['status'].split(" "))[1] | int -%}
{% set result = load_result(insert_query_name) %}

{% if 'response' in result.keys() %} {# added in v0.19.0 #}
{% set rows_inserted = result['response']['rows_affected'] %}
{% else %} {# older versions #}
{% set rows_inserted = result['status'].split(" ")[2] | int %}
{% endif %}

{%- set sum_rows_inserted = loop_vars['sum_rows_inserted'] + rows_inserted -%}
{%- do loop_vars.update({'sum_rows_inserted': sum_rows_inserted}) %}
Expand All @@ -103,7 +109,7 @@

{% endfor %}

{% call noop_statement(name='main', status="INSERT {}".format(loop_vars['sum_rows_inserted']) ) -%}
{% call noop_statement('main', "INSERT {}".format(loop_vars['sum_rows_inserted']) ) -%}
{{ tmp_table_sql }}
{%- endcall %}

Expand All @@ -114,9 +120,15 @@
{{ build_sql }}
{% endcall %}

{%- set rows_inserted = (load_result("main")['status'].split(" "))[1] | int -%}
{% set result = load_result('main') %}

{% if 'response' in result.keys() %} {# added in v0.19.0 #}
{% set rows_inserted = result['response']['rows_affected'] %}
{% else %} {# older versions #}
{% set rows_inserted = result['status'].split(" ")[2] | int %}
{% endif %}

{% call noop_statement(name='main', status="BASE LOAD {}".format(rows_inserted)) -%}
{% call noop_statement('main', "BASE LOAD {}".format(rows_inserted)) -%}
{{ build_sql }}
{%- endcall %}

Expand Down
20 changes: 16 additions & 4 deletions macros/materialisations/vault_insert_by_rank_materialization.sql
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@
);
{%- endcall %}

{%- set rows_inserted = (load_result(insert_query_name)['status'].split(" "))[1] | int -%}
{% set result = load_result(insert_query_name) %}

{% if 'response' in result.keys() %} {# added in v0.19.0 #}
{% set rows_inserted = result['response']['rows_affected'] %}
{% else %} {# older versions #}
{% set rows_inserted = result['status'].split(" ")[2] | int %}
{% endif %}

{%- set sum_rows_inserted = loop_vars['sum_rows_inserted'] + rows_inserted -%}
{%- do loop_vars.update({'sum_rows_inserted': sum_rows_inserted}) %}
Expand All @@ -89,7 +95,7 @@

{% endfor %}

{% call noop_statement(name='main', status="INSERT {}".format(loop_vars['sum_rows_inserted']) ) -%}
{% call noop_statement('main', "INSERT {}".format(loop_vars['sum_rows_inserted']) ) -%}
{{ filtered_sql }}
{%- endcall %}

Expand All @@ -100,9 +106,15 @@
{{ build_sql }}
{% endcall %}

{%- set rows_inserted = (load_result("main")['status'].split(" "))[1] | int -%}
{% set result = load_result('main') %}

{% if 'response' in result.keys() %} {# added in v0.19.0 #}
{% set rows_inserted = result['response']['rows_affected'] %}
{% else %} {# older versions #}
{% set rows_inserted = result['status'].split(" ")[2] | int %}
{% endif %}

{% call noop_statement(name='main', status="BASE LOAD {}".format(rows_inserted)) -%}
{% call noop_statement('main', "BASE LOAD {}".format(rows_inserted)) -%}
{{ build_sql }}
{%- endcall %}

Expand Down
4 changes: 2 additions & 2 deletions macros/tables/t_link.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{%- macro t_link(src_pk, src_fk, src_payload, src_eff, src_ldts, src_source, source_model) -%}

{{- adapter.dispatch('t_link', packages = dbtvault.get_dbtvault_namespaces())(src_pk=src_pk, src_fk=src_fk, src_payload=src_payload,
src_eff=src_eff, src_ldts=src_ldts, src_source=src_source,
source_model=source_model) -}}
src_eff=src_eff, src_ldts=src_ldts, src_source=src_source,
source_model=source_model) -}}

{%- endmacro %}

Expand Down
2 changes: 1 addition & 1 deletion packages.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
packages:

- package: fishtown-analytics/dbt_utils
version: 0.6.2
version: 0.6.4

0 comments on commit 6d6c2db

Please sign in to comment.