Feat(redshift): Add native Merge support for Redshift#3607
Feat(redshift): Add native Merge support for Redshift#3607themisvaltinos merged 4 commits intomainfrom
Conversation
|
This theoretically looks good but are you able to show the Redshift integration tests still passing by commenting out the branch filter for the cloud tests in .circleci/continue_config.yml? (and re-instating it prior to merge) LogicalMergeMixin had less syntax limitations so I wonder if "upgrading" to Redshift's limited version of MERGE will break things |
Thanks for this suggestion I tested it and it appears to be working as expected
I was wondering of this as well, but given that logical merge does not support |
| return expression | ||
|
|
||
| # Redshift does not support multiple "WHEN MATCHED" clauses. | ||
| if len(whens.expressions) != 2: |
There was a problem hiding this comment.
The !=2 check makes some assumptions about how this code is called.
Would counting the exp.When objects where matched=True and matched=False and erroring if there is more than 1 of each be more robust?
There was a problem hiding this comment.
Yes good point also more future proof in case we change how we construct when_matched. Revised it to check that there are only one exp.When with matched=True and one with matched=False
Thanks, looks good!
Every change carries risk :) but in this case, our tests pass so I think we are good. If this change breaks someones workflow, its an opportunity to improve our test suite |
48e8249 to
beb9605
Compare
This update adds native
MERGEsupport for Incremental by Unique Key models in Redshift (fixes: #3316)This required adjustments to the generated statement to accommodate for the lack of alias support for the target table and limitations of the when matched clause Redshift MERGE Documentation