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

Test incremental model with unique key both as string and list #96

Merged
merged 10 commits into from
Feb 22, 2022

Conversation

VersusFacit
Copy link
Contributor

@VersusFacit VersusFacit commented Feb 17, 2022

Resolves #91
Adds tests to this adapter for unique key changes in PR 4618 in dbt-core.

Description

Adds three classes to mirror the branching paths (unique_key as string, list, both). I tried not to duplicate tests already found in dbt-core. Where possible, I followed existing conventions (e.g. using expected SQL models for comparison). There's a ton of side effects by virtue of model building, but I've attempted to keep things readable by separating out steps into functions.

To help, I've added intention based documentation where possible, but feel free to request more!

I've written a set of tests that not only covers several ways to specify unique_key but also simulates real-world incremental update behavior. In doing so, these tests ensure model build and uniqueness semantics are carried out. I mocked up examples in a jaffle_shop first since incremental behavior is a bit wonky at first.

Because incremental model behavior requires multiple runs to display, I opted for actual model files as opposed to queries in code.

edit: Sorry for the force pushes. I had to tease out last minute an error due to mission unique_key in an integration test. It was passing locally but here until I got the parameters just right. Just one of those bugs! Should be reliably resolved though. And then this PR fell prey to the Jinja dependency failure. Integration tests are passing locally.

Ps: I have also been requested to create documentation for Leona to update community docs and am midway through its production. I've already met with @runleonarun synchronously and showed her a lot of the new featureset added. Would be happy to share this with the team.

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-snowflake next" section.

@VersusFacit VersusFacit added the enhancement New feature or request label Feb 17, 2022
@VersusFacit VersusFacit self-assigned this Feb 17, 2022
@cla-bot cla-bot bot added the cla:yes label Feb 17, 2022
@VersusFacit VersusFacit force-pushed the CT-129/add_incremental_unique_id_test branch 2 times, most recently from e96e7ff to b09dc94 Compare February 17, 2022 11:10
@VersusFacit VersusFacit marked this pull request as draft February 17, 2022 20:04
@VersusFacit VersusFacit marked this pull request as ready for review February 18, 2022 12:11
@VersusFacit
Copy link
Contributor Author

VersusFacit commented Feb 18, 2022

Currently suffering from the MarkupSafe==2.0.1, but integration tests are running smoothly locally.

Aaaannd all systems green 🚀 ready once more for review

@VersusFacit VersusFacit changed the title Make general tests and tests for unique key as string. Test incremental model with unique key both as string and list Feb 19, 2022
Copy link
Contributor

@kwigley kwigley left a comment

Choose a reason for hiding this comment

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

This looks good to me! I appreciate the edge cases covered here. No request changes from me, but I'm leaving approval up to another reviewer 👍

Copy link
Contributor

@ChenyuLInx ChenyuLInx left a comment

Choose a reason for hiding this comment

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

This looks great. It covered all of the possible cases as far as I can tell. Added a few nitpicking comment for naming stuff.

CHANGELOG.md Outdated Show resolved Hide resolved
Revised the test for failures to be more accurate and performed a bit of renaming. I also folded two methods into setup that didn't need their own level of abstraction.
Copy link
Contributor

@ChenyuLInx ChenyuLInx left a comment

Choose a reason for hiding this comment

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

Looks great to me!

@VersusFacit VersusFacit merged commit 71f2f43 into main Feb 22, 2022
@VersusFacit VersusFacit deleted the CT-129/add_incremental_unique_id_test branch February 22, 2022 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CT-129] Add integration test for new list input for unique ID
4 participants