-
Notifications
You must be signed in to change notification settings - Fork 87
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 workaround for temporary tables in remote database when running incremental model #326
Add workaround for temporary tables in remote database when running incremental model #326
Conversation
The approach here makes sense to me-- how are we testing this out? |
Well, I'm working on adding a unit test for this, based on the manual test I ran. I noticed there are test files Also, I saw that the |
That sounds great— and yes, I trust that you will not break your own
product here. 😉
…On Tue, Jan 30, 2024 at 13:45 Guen Prawiroatmodjo ***@***.***> wrote:
The approach here makes sense to me-- how are we testing this out?
Well, I'm working on adding a unit test for this, based on the manual test
I ran. I noticed there are test files test_motherduck.py and
test_incremental.py, but they're still empty. I think it's out of scope
for this PR to implement the test_incremental.py fully for all backends.
I can add it to test_motherduck.py for now. Does that sound good?
Also, I saw that the md tox environment is currently not tested in CI/CD
(for obvious reasons), so I'll just aim for a local pass if that works for
you.
—
Reply to this email directly, view it on GitHub
<#326 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAECWZE2WYL4XCJEANBPH23YRFSYDAVCNFSM6AAAAABCQZTNHCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJXHE2DQMJQG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Thanks @jwills for the review! I'll address your comments shortly. I also wanted to note that I talked to @nicku33 about this:
We decided to go with a separate schema What are your thoughts? |
I am good with that! |
@guenp apologies to pile this on, but would you mind changing this code to also use your new |
Ah yes, I totally forgot about that, thank you for the reminder! It's done. I've now pushed all my changes. Mainly what I've added since you last reviewed, in addition to addressing your comments:
The behavior now looks something like this: @nicku33 and I decided against dropping |
The model |
Oops, I didn't actually run the unit tests with the default profile. 😁 |
All checks are green! I also added |
…o_drop within if-statement
Thank you very much @guenp! |
Yay! 🎉 Could we hold off on pushing a release until @nicku33 has had the chance to test it on a real-life workload? We just want to make sure this workaround is good on our end as well. Thanks! |
of course, will wait for you all to sign off on it first |
We had the chance to do a full end to end test with "real life" data so this is signed off on our end!
|
A few months ago an issue was raised in the MotherDuck community Slack that
CREATE TEMPORARY TABLE
when using incremental models was causing slowdowns ondbt
.Summary of the underlying issue:
duckdb
instance, all temporary tables are created locallydbt
incremental models create a temporary table for appending tuples to an existing table"md:my_database"
), a new table is created locally, tuples are transported from the server into the new local table, and then sent back to the server when the finalINSERT INTO
is executed. This adds a nontrivial round trip time causing said slowdown.This PR contains a quick suggestion for a workaround until we support temporary tables in MotherDuck. It creates a "mock" temporary table in the database and deletes it afterwards.
Some thoughts for @jwills and @nicku33:
temp
.dbt
to run successfully after a mock temp table is created