Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use common columns for incremental schema changes #51

Merged
merged 3 commits into from
Nov 8, 2021

Conversation

Kayrnt
Copy link
Contributor

@Kayrnt Kayrnt commented Oct 30, 2021

resolves dbt-labs/dbt-core#4144

Description

Using dbt-labs/dbt-core#4170 changes, the goal is to retrieve the intersection from existing table columns and the tmp table columns for the condition to avoid referencing columns that wouldn't be in one or the other table and lead to a failure of the incremental run.

Snowflake equivalent: dbt-labs/dbt-snowflake#38

Checklist

  • I have signed the CLA
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change to the "dbt-bigquery next" section.

@Kayrnt Kayrnt force-pushed the on_schema_change_columns_fix branch from fa7d257 to 64492a0 Compare November 7, 2021 14:03
@Kayrnt Kayrnt force-pushed the on_schema_change_columns_fix branch 7 times, most recently from 3aad884 to 1c1b9bf Compare November 7, 2021 22:03
@@ -87,6 +87,21 @@ def run_incremental_append_new_columns(self):
self.list_tests_and_assert(select, exclude, expected)
self.run_tests_and_assert(select, exclude, expected, compare_source, compare_target)

def run_incremental_append_new_columns_remove_one(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add to test below:

    @use_profile('bigquery')
    def test__bigquery__run_incremental_append_new_columns(self):
        self.run_incremental_append_new_columns()
        self.run_incremental_append_new_columns_remove_one()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed I missed that 😵‍💫
I updated it 👍

@Kayrnt Kayrnt force-pushed the on_schema_change_columns_fix branch from 1c1b9bf to f72116c Compare November 8, 2021 10:14
@jtcohen6 jtcohen6 marked this pull request as ready for review November 8, 2021 10:35
Copy link
Contributor

@jtcohen6 jtcohen6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last but not least — thank you for the thorough work @Kayrnt, and impressive coordination along the way!

@jtcohen6 jtcohen6 merged commit bc31bae into dbt-labs:main Nov 8, 2021
@Kayrnt Kayrnt deleted the on_schema_change_columns_fix branch March 13, 2022 21:24
siephen pushed a commit to AgencyPMG/dbt-bigquery that referenced this pull request May 16, 2022
* Use common columns for incremental schema changes

* Review changes

* Follow up change for lean return version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When on_schema_change is set, pass common columns as dest_columns in incremental merge macros
3 participants