-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with SCD Type 2 models #2782
Comments
Hi, I opened a new issue because you closed the latest one without answerig the question. |
@eakmanrq can you please have a look at this one. |
@zerodarkzone when you're restating that model which environment do you target? |
@zerodarkzone also can you please attach full logs for the run that causes the reported error. |
Hi, I tried to replicate everything and now I'm getting different kind of errors This is the schema of the table when I run the original model. Then when I change the column name and do the plan again I get the following error:
sqlmesh_2024_06_24_10_44_41.log After this, if I run the plan again, it finishes "without problems": At the end, when I try to do a restatement, I get the following error (Leaving the backfill dates blank):
sqlmesh_2024_06_24_10_57_53.log If I input the backfill dates, then I get the folliwing error:
|
@zerodarkzone you're getting this error:
because in dev the default start for forward-only changes is "yesterday" (2024-06-23) in your case, not the "beginning of history" as the message suggests. We should've fixed the message, which version are you on? So this error will be gone if you set the start date to before |
With regard to the
|
The fact that subsequent plan succeeds after previously failing to update the table's schema is an actual bug here. Basically SQLMesh creates a dev table but fails to update its schema. Next time the plan runs, it checks that the table already exists and skips it. This is something we're going to address. |
We will also update the docs to explain how to deal with the |
Hi,
Could you explain what does the enable-preview flag actually does?
I don't know if I explained the problem correctly.
Basically, sqlmesh plan is not updating the schema of the SCD Type 2 models and the backfill fails when trying to do a restatement.
Is that the expected behaviour?
The original model was something like:
Then I just renamed a column and now the model is:
When running
sqlmesh plan dev
the view schema is not changed.When running
--restate-model "silver.articulos_curado"
Then I get the following error:
It is basically telling me that the renamed column does not exists.
Please don't close an issue without responding to the actual problem.
Thanks
Originally posted by @zerodarkzone in #2764 (comment)
The text was updated successfully, but these errors were encountered: