fix: scd type 2 support table properties#5317
Merged
Conversation
eakmanrq
commented
Sep 8, 2025
Comment on lines
+2286
to
2293
| return self.insert( | ||
| table_name, | ||
| query_or_df, | ||
| model, | ||
| is_first_insert=False, | ||
| render_kwargs=render_kwargs, | ||
| force_get_columns_from_target=True, | ||
| **kwargs, | ||
| ) |
Collaborator
Author
There was a problem hiding this comment.
An append in this context seems to just be an insert where is_first_insert is False so updated it to reflect that and remove duplicate code.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes SCD Type 2 model support for table properties like partitioned_by by ensuring these properties are properly passed to the adapter during follow-up inserts and appends that replace the table.
- Consolidates
insertandappendmethods to use the same implementation - Adds table properties parameters to SCD Type 2 adapter calls in the insert method
- Updates tests to verify partition properties are preserved in SCD Type 2 operations
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| sqlmesh/core/snapshot/evaluator.py | Modified insert method to pass table properties to SCD adapters; simplified append method to delegate to insert |
| tests/core/test_snapshot_evaluator.py | Added test case with partitioned_by property and verification of adapter calls |
| tests/core/engine_adapter/test_bigquery.py | Added BigQuery-specific test to verify partition properties in SCD Type 2 operations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
4630a89 to
bc4beca
Compare
bc4beca to
c6d5590
Compare
izeigerman
approved these changes
Sep 8, 2025
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.
Slack context: https://tobiko-data.slack.com/archives/C044BRE5W4S/p1757327355130579
Prior to this PR, users could define a partition by on their SCD type 2 model and it wouldn't be implemented properly on follow-up inserts/appends that replace the table. This PR fixes that.