Skip to content

Commit

Permalink
(#1665) Fix for casting error on old versions of postgres in snapshot…
Browse files Browse the repository at this point in the history
… queries
  • Loading branch information
drewbanin committed Aug 6, 2019
1 parent b2f2e69 commit b7e8670
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
update {{ target }}
set dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to
from {{ source }} as DBT_INTERNAL_SOURCE
where DBT_INTERNAL_SOURCE.dbt_scd_id = {{ target }}.dbt_scd_id
and DBT_INTERNAL_SOURCE.dbt_change_type = 'update'
where DBT_INTERNAL_SOURCE.dbt_scd_id::text = {{ target }}.dbt_scd_id::text
and DBT_INTERNAL_SOURCE.dbt_change_type::text = 'update'::text
and {{ target }}.dbt_valid_to is null;

insert into {{ target }} ({{ insert_cols_csv }})
select {% for column in insert_cols -%}
DBT_INTERNAL_SOURCE.{{ column }} {%- if not loop.last %}, {%- endif %}
{%- endfor %}
from {{ source }} as DBT_INTERNAL_SOURCE
where DBT_INTERNAL_SOURCE.dbt_change_type = 'insert';
where DBT_INTERNAL_SOURCE.dbt_change_type::text = 'insert'::text;
{% endmacro %}

0 comments on commit b7e8670

Please sign in to comment.