-
Notifications
You must be signed in to change notification settings - Fork 208
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
Custom schemas: table already exists #38
Comments
So what I think is happening here is that DBT isn't picking up that the table already exists when it attempts a subsequent run. Therefore it isn't running the The old relation is identified using an adapter macro However the https://github.com/fishtown-analytics/dbt-spark/blob/master/dbt/adapters/spark/impl.py We are really keen to get this issue solved and would like to put in a pull request. Is it possible to get someone to check my logic so I know I'm heading in the right direction? cc: @drewbanin |
Question, why do we need to check it the table exists at all? Couldn't we just use the keyword So we could instead do something like: -- setup: if the target relation already exists, drop it
-- Notice there is no need to check if relation exists before dropping it.
{{ adapter.drop_relation(old_relation) }} The macro implementation of |
hey @eamontaaffe - thanks for your thoughtful writeup here! I appreciate your patience - it was hard to get back in the swing of the dbt-spark plugin, but I'm excited to get this (and the other open PRs in this repo) merged! I think the change you've proposed here is uncontroversial - let me pick this up with you in the open PR. |
Awesome, thanks @drewbanin. I'm excited about some of the other issues & PRs that are currently open too! Version 15 is support will be amazing. We have been using the changes proposed in #42 for the last 4-5 days and it seems to be behaving as expected. |
In the spirit of figuring out what was actually going wrong with I think we should fix
Or we could re-implement |
@jtcohen6 I think we'd want to override |
@drewbanin Good call. Is #52 what you had in mind? |
Issues with re-running workflows when using custom schemas.
When I create a model with a custom schema configured:
I am able to run the workflow successfully once:
However, if I run the same workflow again I get an error:
Instead, the table should be dropped and recreated. If we repeat the same exercise without the
schema='clean'
configuration, everything works as expected.The text was updated successfully, but these errors were encountered: