Fix uniqueKey assertions for views, incremental tables#1836
Merged
Ekrekr merged 1 commit intodataform-co:mainfrom Oct 7, 2024
Merged
Fix uniqueKey assertions for views, incremental tables#1836Ekrekr merged 1 commit intodataform-co:mainfrom
uniqueKey assertions for views, incremental tables#1836Ekrekr merged 1 commit intodataform-co:mainfrom
Conversation
Contributor
|
Thank you so much for this fix! It would have been approved earlier, but there's been a lot on. It looks good - I'll merge main in with this and make sure the remote tests pass before merging. Fixes #1835 |
Ekrekr
approved these changes
Oct 7, 2024
benjaminwestern
pushed a commit
to benjaminwestern/dataform-testing
that referenced
this pull request
Nov 9, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Bug
This PR fixes a bug where
uniqueKeyassertions on views and incremental tables causeddataform runto exit with a query error.uniqueKeyassertions on tables, as well as alluniqueKeysassertions still worked. Affected versions:3.0.1,3.0.2. I don't know whether executions on GCP were also affected.Steps to reproduce
3.0.1or3.0.2of@dataform/core.dataform run. Observe the following error message:The Fix
I don't fully understand what happened. The query complains about an undefined column
TableAssertionsConfig, and the newly refactored implementations forviewandincremental_tablecontain this hardcoded string foruniqueKeyassertions. I'm not sure what the hardcoded string is meant to be referring to. Just replacing the hardcoded string with the user-supplied column names fixes the issue.The Tests
The suite in
core/main_test.tstested assertions forviews,tablesandincremental_tables, for the following assertions:uniqueKeys,nonNull,rowConditions.uniqueKeyassertions were untested, I assume because they're incompatible with auniqueKeysassertion. I extended the test suite to also include tests foruniqueKeyassertions, for all three tested table kinds. I worked around the incompatibility by introducing a second sample file. Apart from the differentassertionsblock, the second file's contents are identical to the contents of the first file.This has confirmed the bug, as well as the fix.
I nominate @Ekrekr as reviewer.