-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
During a DBT run, dropping a view will also drop dependent views that haven't been recreated. #2185
Comments
hey @nickwu241 - this is a good question! There isn't any mechanism in Postgres to define a view as "late bound" or "unbound" or anything like that. dbt unfortunately must
My recommendation would be to either:
Closing this as I don't anticipate making any changes to dbt to support this use-case on Postgres, but I do want to validate that the issue you're seeing is real, it's just not one that Postgres makes particularly easy for dbt to support today. |
@drewbanin Thank you for the detailed response and also with the recommendations, I appreciate it very much! We are actually currently using Redshift for analytics but I produced the issue in Postgres because it's easier to reproduce with docker. So for the short term I'll use
Thanks again! |
Describe the bug
When there are views in the DAGs e.g. (
view_root
->view_middle
->view_leaf
)A
dbt run
causes problems because:view_root
completes, it'll drop all its dependent views, i.e.view_middle
andview_leaf
in this case.view_middle
andview_leaf
will not be re-created until they're run.view_root
might run very early in a run whileview_middle
andview_leaf
run hours later and causes these views to not be available.view_middle
andview_leaf
are broken whiledbt
is running.Steps To Reproduce
Created a sample dbt project to reproduce: https://github.com/nickwu241/dbt_reproduce_drop_view_cascade_bug
It will
view_root
->view_middle
->view_leaf
SELECT * FROM pg_sleep(10)
view_middle
andview_leaf
are unavailable afterview_root
runs.10
to be30
if you need more time to see the databaseExpected behavior
I expect
dbt
to not drop the dependent views until the wholerun
has finished.I expect
DROP VIEW view_root_backup CASCADE;
won't happen until all dependent views are re-created.Screenshots and log output
System information
Which database are you using dbt with?
The output of
dbt --version
:The operating system you're using:
macOS Mojave 10.14.6
The output of
python --version
:Python 3.7.3
Additional context
Let me know if you require more information or have any questions! You can reach me on the DBT slack as
Nick Wu
as well.Thank you!
The text was updated successfully, but these errors were encountered: