diff --git a/CHANGELOG.md b/CHANGELOG.md index 00ff8f18..5e031de4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ### Fixes - Supporting custom schemas in incremental models ([#17](https://github.com/starburstdata/dbt-trino/issues/17), [#39](https://github.com/starburstdata/dbt-trino/pull/39)) - Supporting column type overrides in seeds ([#42](https://github.com/starburstdata/dbt-trino/issues/42)), ([#44])(https://github.com/starburstdata/dbt-trino/pull/44)) +- Supporting partial column matches in incremental models ([#49](https://github.com/starburstdata/dbt-trino/pull/49)) ### Under the hood - Add missing tests to Makefile ([#43](https://github.com/starburstdata/dbt-trino/pull/43)) @@ -16,6 +17,7 @@ Contributors: * [@austenLacy](https://github.com/austenLacy) ([#45](https://github.com/starburstdata/dbt-trino/pull/45)) * [@rahulj51](https://github.com/rahulj51) ([#39](https://github.com/starburstdata/dbt-trino/pull/39)) * [@mdesmet](https://github.com/mdesmet) ([#44])(https://github.com/starburstdata/dbt-trino/pull/44)) +* [@prgx-aeveri01](https://github.com/prgx-aeveri01) ([#49](https://github.com/starburstdata/dbt-trino/pull/49)) ## dbt-trino 1.0.1 (January 24, 2022) diff --git a/dbt/include/trino/macros/materializations/incremental.sql b/dbt/include/trino/macros/materializations/incremental.sql index a1a96069..9d4edeac 100644 --- a/dbt/include/trino/macros/materializations/incremental.sql +++ b/dbt/include/trino/macros/materializations/incremental.sql @@ -1,8 +1,8 @@ {% macro dbt_trino_get_append_sql(tmp_relation, target_relation) %} - {%- set dest_columns = adapter.get_columns_in_relation(target_relation) -%} + {%- set dest_columns = adapter.get_columns_in_relation(tmp_relation) -%} {%- set dest_cols_csv = dest_columns | map(attribute='quoted') | join(', ') -%} - insert into {{ target_relation }} + insert into {{ target_relation }} ({{ dest_cols_csv }}) select {{dest_cols_csv}} from {{ tmp_relation.include(database=true, schema=true) }}; drop table if exists {{ tmp_relation }};