-
Notifications
You must be signed in to change notification settings - Fork 121
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
Cannot materialize view
models shared via Delta Sharing
#781
Comments
@benc-db for when you're back from vacation |
This is an interesting edge case that will require some significant testing. The safest change would be to only use alter in place of 'create or replace' if the table is being delta-shared. Is there a tblproperty that indicates this? |
@benc-db I don't believe so, the closest piece of metadata I found was by calling the REST API and grabbing the
For Delta-shared tables/views, the I'd like to see if I can grab |
My team experiences the same issue. We would be glad about a solution as well. @shivonchain If I'm not mistaken then the The only way I found to check if a view is being delta-shared is using a requests to the shares api: @benc-db would it maybe be better to try to execute the |
Describe the bug
When trying to materialize a
view
in dbt viadbt run
ordbt build
, and the view is shared via Delta Sharing, the materialization fails:To update a view definition when the underlying view is shared over Delta Sharing,
ALTER VIEW
should be used instead ofCREATE OR REPLACE
, which is issued by dbt forview
models. Ideally, this is baked into the default view materialization indbt-databricks
.An alternative I have considered is to use pre- and post-hooks to remove and add the view back to the underlying share. However, this is not always feasible.
Steps To Reproduce
In as much detail as possible, please provide steps to reproduce the issue. Sample data that triggers the issue, example model code, etc is all very helpful here.
dbt run -s <model>
.Expected behavior
I expect the dbt view to be materialized even if it is shared by Delta Sharing. The
view
materialization should check if the view exists; if it does, thenALTER VIEW
should be issued to Databricks instead ofCREATE OR REPLACE
to update the view definition.Screenshots and log output
If applicable, add screenshots or log output to help explain your problem.
System information
The output of
dbt --version
:The operating system you're using: macOS, M3 Max
The output of
python --version
: Python 3.12.3Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: