Add lookup_choice transformer - #1148
Open
kvch wants to merge 1 commit into
Open
Conversation
tier |
CoverageTotal: 61.4% (+0.2% vs Coverage in packages changed by this PR:
|
|
@kvch FYI this will need to ensure that lookup table stream is fully updated first (in snapshot mode - replication mode should be OK), if that's not already taken care of, otherwise the lookup will try to add ids that don't yet exist in the target. Particularly bad if there are parallel table workers going on. Alternately the lookup could be done in the target, but that's not as nice. |
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.
Description
This PR adds a transformer named
lookup_choice. It replaces a column value with one read from a column of another table, loaded from the source database once when the pipeline starts. This is the live-table counterpart ofgreenmask_choice, which chooses from a list written into the configuration. The main issue was thatgreenmask_choiceandgreenmask_integerforce users to regenerate their YAML whenever the lookup table's contents change.The name is not
foreign_key_choice, as the issue proposes, because nothing here queriespg_constraintor checks that a foreign key exists.lookup_tablepublic.countriesmeans lowercasecountries.lookup_columnIS NOT NULLand anORDER BY.generator: deterministicrandompicks independently per row and destroys that grouping.ignore_values: [0, -1]postgres_urlExample configuration
Related Issue(s)
Type of Change
Please select the relevant option(s):
Testing
Checklist