Skip to content

Commit

Permalink
Updates from local testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jtcohen6 committed Sep 3, 2020
1 parent 793efb4 commit 90a58ea
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
4 changes: 3 additions & 1 deletion macros/external/create_external_table.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% macro create_external_table(source_node) %}
{{ adapter.dispatch('create_external_table', dbt_external_tables._get_dbt_external_tables_namespaces()) (source_node) }}
{{ adapter.dispatch('create_external_table',
packages = dbt_external_tables._get_dbt_external_tables_namespaces())
(source_node) }}
{% endmacro %}

{% macro default__create_external_table(source_node) %}
Expand Down
4 changes: 3 additions & 1 deletion macros/external/refresh_external_table.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% macro refresh_external_table(source_node) %}
{{ return(adapter_macro('dbt_external_tables.refresh_external_table', source_node)) }}
{{ return(adapter.dispatch('refresh_external_table',
packages = dbt_external_tables._get_dbt_external_tables_namespaces())
(source_node)) }}
{% endmacro %}

{% macro default__refresh_external_table(source_node) %}
Expand Down
9 changes: 5 additions & 4 deletions macros/external/stage_external_sources.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% macro get_external_build_plan(source_node) %}
{{ return(adapter_macro('dbt_external_tables.get_external_build_plan', source_node)) }}
{{ return(adapter.dispatch('get_external_build_plan',
packages = dbt_external_tables._get_dbt_external_tables_namespaces())
(source_node)) }}
{% endmacro %}

{% macro default__get_external_build_plan(source_node) %}
Expand Down Expand Up @@ -116,17 +118,16 @@

{% do dbt_utils.log_info(loop_label ~ ' SKIP') if run_queue == [] %}

{% do dbt_external_tables.exit_transaction() %}

{% for q in run_queue %}

{% set q_msg = q|trim %}
{% set q_log = q_msg[:50] ~ '... ' if q_msg|length > 50 else q_msg %}

{% do dbt_utils.log_info(loop_label ~ ' (' ~ loop.index ~ ') ' ~ q_log) %}
{% set exit_txn = dbt_external_tables.exit_transaction() %}

{% call statement('runner', fetch_result = True, auto_begin = False) %}
{{ q }}
{{ exit_txn }} {{ q }}
{% endcall %}

{% set status = load_result('runner')['status'] %}
Expand Down
2 changes: 1 addition & 1 deletion macros/helpers/common.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{% set package_context = context[package_name] %}
{% else %}
{% set error_msg %}
In adapter_macro: could not find package '{{package_name}}', called with '{{original_name}}'
Could not find package '{{package_name}}', called by macro '{{original_name}}'
{% endset %}
{{ exceptions.raise_compiler_error(error_msg | trim) }}
{% endif %}
Expand Down
6 changes: 3 additions & 3 deletions macros/helpers/redshift/transaction.sql
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{% macro exit_transaction() %}
{{ return(adapter_macro('dbt_external_tables.exit_transaction')) }}
{{ return(adapter.dispatch('exit_transaction', dbt_external_tables._get_dbt_external_tables_namespaces())()) }}
{% endmacro %}

{% macro default__exit_transaction() %}
{# noop #}
{{ return('') }}
{% endmacro %}

{% macro redshift__exit_transaction() %}
{% do run_query('begin; commit;') %}
{{ return('begin; commit;') }}
{% endmacro %}

0 comments on commit 90a58ea

Please sign in to comment.