Skip to content

Commit

Permalink
updated stream and stage creation process
Browse files Browse the repository at this point in the history
  • Loading branch information
jonhopper-dataengineers committed Aug 17, 2022
1 parent a22ea42 commit 26fecb9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
) %}

{% set sql = render(source_node.get('raw_sql')) %}
{% set build_plan = build_plan + [dbt_dataengineers_materilizations.snowflake_create_stages_statement(stage_relation, sql)] %}
{% set build_plan = build_plan + [dbt_dataengineers_materilizations.snowflake_create_stages_if_not_exist_statement(stage_relation, sql)] %}


{% endif %}
Expand Down
7 changes: 5 additions & 2 deletions macros/streams/snowflake__stream.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
{%- set source_type = config.get('source_type', default='internal') -%}

{% set target_relation = this %}
{% set existing_relation = load_relation(this) %}
{% set source_relation = adapter.get_relation( identifier=source_model, schema=source_schema, database=database) %}
{% set source_relation = adapter.get_relation(identifier=source_model, schema=source_schema, database=database) %}

{% if source_relation == none %}
{% set source_relation = api.Relation.create(identifier=source_model, schema=source_schema, database=database) %}
{% endif %}

-- setup
{{ run_hooks(pre_hooks, inside_transaction=False) }}
Expand Down

0 comments on commit 26fecb9

Please sign in to comment.