Skip to content

Commit

Permalink
Merge pull request #15 from fishtown-analytics/fix/snowflake-updates
Browse files Browse the repository at this point in the history
Fixes for Snowflake updates
  • Loading branch information
jtcohen6 authored Jan 21, 2020
2 parents c01bb96 + 4377ae0 commit 6553a74
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions macros/external/create_external_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@
{% endfor %}
)
{% if partitions -%} partition by ({{partitions|map(attribute='name')|join(', ')}}) {%- endif %}
{% if external.location -%} location = {{external.location}} {%- endif %} {# stage #}
location = {{external.location}} {# stage #}
{% if external.auto_refresh -%} auto_refresh = {{external.auto_refresh}} {%- endif %}
{% if external.file_format -%} file_format = {{external.file_format}} {%- endif %}
{% if external.pattern -%} pattern = {{external.pattern}} {%- endif %}
file_format = {{external.file_format}}
{% endmacro %}

{% macro bigquery__create_external_table(source_node) %}
Expand Down
7 changes: 4 additions & 3 deletions macros/external/stage_external_sources.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

{% if node.resource_type == 'source' and node.external.location != none %}

{%- do log('Staging external table ' ~ node.source_name ~ '.' ~ node.name, info = true) -%}
{% set ts = modules.datetime.datetime.now().strftime('%H:%M:%S') %}
{%- do log(ts ~ ' + Staging external table ' ~ node.source_name ~ '.' ~ node.name, info = true) -%}

{%- set run_queue = [] -%}

Expand All @@ -15,7 +16,7 @@

{%- do run_queue.append(create_external_table(node)) -%}

{%- if node.external.partitions and target.type != 'spark' -%}
{%- if node.external.partitions and target.type == 'redshift' -%}
{%- set run_queue = run_queue + refresh_external_table(node).split(';') -%}
{%- endif -%}

Expand All @@ -25,8 +26,8 @@
{{ q }}
{% endcall %}

{% set status = load_result('runner')['status'] %}
{% set ts = modules.datetime.datetime.now().strftime('%H:%M:%S') %}
{% set status = load_result('runner')['status'] %}
{% set msg = ts ~ ' + (' ~ loop.index ~ ') ' ~ status %}
{% do log(msg, info = true) %}

Expand Down

0 comments on commit 6553a74

Please sign in to comment.