diff --git a/dbt_project.yml b/dbt_project.yml index d4946d831..c26e9ac76 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -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"] diff --git a/macros/materialisations/vault_insert_by_period_materialization.sql b/macros/materialisations/vault_insert_by_period_materialization.sql index 5ace50eb8..1dbb9b840 100644 --- a/macros/materialisations/vault_insert_by_period_materialization.sql +++ b/macros/materialisations/vault_insert_by_period_materialization.sql @@ -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}) %} @@ -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 %} @@ -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 %} diff --git a/macros/materialisations/vault_insert_by_rank_materialization.sql b/macros/materialisations/vault_insert_by_rank_materialization.sql index 23da8d8cb..befea12ae 100644 --- a/macros/materialisations/vault_insert_by_rank_materialization.sql +++ b/macros/materialisations/vault_insert_by_rank_materialization.sql @@ -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}) %} @@ -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 %} @@ -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 %} diff --git a/macros/tables/t_link.sql b/macros/tables/t_link.sql index 638724923..c12b4466a 100644 --- a/macros/tables/t_link.sql +++ b/macros/tables/t_link.sql @@ -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 %} diff --git a/packages.yml b/packages.yml index e531cd821..09a6842db 100644 --- a/packages.yml +++ b/packages.yml @@ -1,4 +1,4 @@ packages: - package: fishtown-analytics/dbt_utils - version: 0.6.2 \ No newline at end of file + version: 0.6.4 \ No newline at end of file