Skip to content

Commit

Permalink
Merge pull request #1709 from fishtown-analytics/fix/simplify-snapsho…
Browse files Browse the repository at this point in the history
…t-check-logic

make snapshot check strategy simpler and still correct
  • Loading branch information
drewbanin committed Aug 28, 2019
2 parents c002858 + 3437b0f commit ce58da8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This is primarily a bugfix release which contains a few minor improvements too.
- Add `node.config` and `node.tags` to the `generate_schema_name` and `generate_alias_name` macro context ([#1700](https://github.com/fishtown-analytics/dbt/issues/1700), [#1701](https://github.com/fishtown-analytics/dbt/pull/1701))

### Fixes:
- Fix for reused `check_cols` values in snapshots ([#1614](https://github.com/fishtown-analytics/dbt/pull/1614))
- Fix for reused `check_cols` values in snapshots ([#1614](https://github.com/fishtown-analytics/dbt/pull/1614), [#1709](https://github.com/fishtown-analytics/dbt/pull/1709))
- Fix for rendering column descriptions in sources ([#1619](https://github.com/fishtown-analytics/dbt/issues/1619), [#1633](https://github.com/fishtown-analytics/dbt/pull/1633))
- Fix for `is_incremental()` returning True for models that are not materialized as incremental models ([#1249](https://github.com/fishtown-analytics/dbt/issues/1249), [#1608](https://github.com/fishtown-analytics/dbt/pull/1608))
- Fix for serialization of BigQuery results which contain nested or repeated records ([#1626](https://github.com/fishtown-analytics/dbt/issues/1626), [#1638](https://github.com/fishtown-analytics/dbt/pull/1638))
Expand Down Expand Up @@ -51,7 +51,7 @@ Thanks for your contributions to dbt!
- [@edmundyan](https://github.com/edmundyan) ([#1663](https://github.com/fishtown-analytics/dbt/pull/1663))
- [@vitorbaptista](https://github.com/vitorbaptista) ([#1664](https://github.com/fishtown-analytics/dbt/pull/1664))
- [@sjwhitworth](https://github.com/sjwhitworth) ([#1672](https://github.com/fishtown-analytics/dbt/pull/1672), [#1673](https://github.com/fishtown-analytics/dbt/pull/1673))
- [@mikaelene](https://github.com/mikaelene) ([#1688](https://github.com/fishtown-analytics/dbt/pull/1688))
- [@mikaelene](https://github.com/mikaelene) ([#1688](https://github.com/fishtown-analytics/dbt/pull/1688), [#1709](https://github.com/fishtown-analytics/dbt/pull/1709))
- [@bastienboutonnet](https://github.com/bastienboutonnet) ([#1591](https://github.com/fishtown-analytics/dbt/pull/1591), [#1689](https://github.com/fishtown-analytics/dbt/pull/1689))


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,7 @@
)
{%- endset %}

{% if target_exists %}
{% set row_version -%}
(
select count(*) from {{ snapshotted_rel }}
where {{ snapshotted_rel }}.dbt_unique_key = {{ primary_key }}
)
{%- endset %}
{% set scd_id_cols = [primary_key, row_version] + (check_cols | list) %}
{% else %}
{% set scd_id_cols = [primary_key] + (check_cols | list) %}
{% endif %}

{% set scd_id_expr = snapshot_hash_arguments(scd_id_cols) %}
{% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}

{% do return({
"unique_key": primary_key,
Expand Down

0 comments on commit ce58da8

Please sign in to comment.