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

Add table rename at the end of each refresh #57

Closed
nbenezri opened this issue Jan 23, 2023 · 5 comments
Closed

Add table rename at the end of each refresh #57

nbenezri opened this issue Jan 23, 2023 · 5 comments
Assignees

Comments

@nbenezri
Copy link

Some tables take a long time to refresh, like:

09:12:05  119 of 175 START table model cdp_stripe.stripe__invoice_line_items ............. [RUN]
09:15:08  119 of 175 OK created table model cdp_stripe.stripe__invoice_line_items ........ [SELECT in 183.45s]

During this time - the table is not available to query in prod.
One way to resolve this is to run in the end:

DROP TABLE IF EXISTS cdp_stripe.stripe__invoice_line_items_prod;
ALTER TALBE cdp_stripe.stripe__invoice_line_items rename to cdp_stripe.stripe__invoice_line_items_prod;

Is there such a way to do it when each table is ready?

@fivetran-reneeli
Copy link
Contributor

Hi @nbenezri thanks for opening this issue!

Just to confirm I understand, are you saying that after the refreshed table gets created again, you're unable to query from it? But by renaming the table then you can? I'm having trouble understanding why it's unable to be queried in the first place. Or, can you query in dev, just not in prod?

@fivetran-reneeli fivetran-reneeli self-assigned this Jan 23, 2023
@nbenezri
Copy link
Author

When the refreshes going on it is unavailable. In the above example, during 09:12:05 - 09:15:08.

@fivetran-reneeli
Copy link
Contributor

Hi @nbenezri sorry for the delay! I understand the issue you're experiencing, though this is the way dbt works as is it runs a create or replace statement. I think the issue may be better resolved looking at how your environment is set up. I would suggest working with your engineering team to make sure your dashboards are still available during table refreshes-- there should be some kind of best practices for when prod goes offline temporarily.

@nbenezri
Copy link
Author

nbenezri commented Jan 29, 2023 via email

@fivetran-reneeli
Copy link
Contributor

Yeah, this is something more likely within dbt-core or your internal architecture! Will close this issue as this falls outside the realm of our packages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants