You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is my first post, so... nice to meet you and SQLMesh is killer!
But I cant find a good solution to this one: Preventing a specific column (created_date) from getting updated during the merge process in an "incremental by unique key" model.
Possible solutions so far, to my knowledge:
a) Use "when_matched" to specify updates on all columns except this special one and be very careful when doing model changes, to not forget something in the future. I feel this approach being just too much overhead, especially on wide tables.
b) Self joining the resulting model and doing something like coalesce({{this_model}}.created_date, current_timestamp), which could mean to join in very large tables to get one piece of information and slowing down things. Also, it would require "hard-defining" column types in order for self joins to work.
"Maybe solutions" that dont seem to work so far:
c) Column defaults (Not supported for my iceberg tables on trino)
"Future solutions" (?)
d) An additional "merge_exclude_columns" parameter (dbt has this)
e) Extending the "when_matched" part, in order to just override the specified column-updates, without the need to re-code the whole statement for the rest
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everybody,
This is my first post, so... nice to meet you and SQLMesh is killer!
But I cant find a good solution to this one: Preventing a specific column (created_date) from getting updated during the merge process in an "incremental by unique key" model.
Possible solutions so far, to my knowledge:
a) Use "when_matched" to specify updates on all columns except this special one and be very careful when doing model changes, to not forget something in the future. I feel this approach being just too much overhead, especially on wide tables.
b) Self joining the resulting model and doing something like coalesce({{this_model}}.created_date, current_timestamp), which could mean to join in very large tables to get one piece of information and slowing down things. Also, it would require "hard-defining" column types in order for self joins to work.
"Maybe solutions" that dont seem to work so far:
c) Column defaults (Not supported for my iceberg tables on trino)
"Future solutions" (?)
d) An additional "merge_exclude_columns" parameter (dbt has this)
e) Extending the "when_matched" part, in order to just override the specified column-updates, without the need to re-code the whole statement for the rest
What else could I try?
Greetings
Beta Was this translation helpful? Give feedback.
All reactions