Skip to content
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

Schema evolution for databricks delta is not working using pre_hook #217

Closed
cvsekhar opened this issue Sep 16, 2021 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@cvsekhar
Copy link

Describe the feature
We are using DBT+Spark on Delta for incremental load. As we are getting data from various sources, one of the key features is to be able to support schema evolution. Delta lake does support it with the merge command as documented here
Can this be supported by DBT?

Describe alternatives you've considered
the current alternative is refresh all, this has too issues:

very time consuming
As part of ingesting the data, we keep the histories and some of our source data don't maintain history. the refresh all will lose this historic records
Who will this benefit?
I saw another issue #162 that the issue has been fixed, when I have tried to use the same solution it doesn't work

@jtcohen6
Copy link
Contributor

@cvsekhar Sorry for the delay getting back to you!

There are a few problems with set statements is that:

So if you want to set spark.databricks.delta.schema.autoMerge.enabled = true, I believe you can in one of two ways:

We need to do a better job of documenting both. And in both cases, you'd have to persist the setting for an entire dbt invocation—it wouldn't be possible to mix and match different settings for different models in the same run.

An alternative: In v0.21, dbt-core introduced a new on_schema_change config, with options for failing, ignoring, or adding columns to incremental models when the query returns a different column schema. You can follow our progress on implementing that over in #226 + #229.

I'm going to close this issue in the meantime.

@cvsekhar
Copy link
Author

Thank you very much fill those instructions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants