-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Allow Direct INSERT in Final Table #35
Comments
Hi, I'd like to work on that. Do you see any new dependencies with other open issues? |
Hey @temminks, thanks for volunteering. As for your question, no, there aren't any pending dependencies that would block this. This one is a bit complex, as it involves breaking into pieces the WriteToDB function. It's one of the more involved pieces of the Sling codebase, since there are specific sequences of transactions that occur in order (depending on the mode), such as:
For this new feature, we'd need to modify the sequence depending on whether
So I figure it's a good opportunity to break up/clean up Do you have any thoughts on how you'd approach this? |
Hi @flarco, I was looking into that function the other day as I was a bit surprise that I have to grant I actually tried to play around with One thing I'm not sure of right now is how you would read the environment variable: do you want to do this inside the function, just using As for an approach, the steps
appear to be one logical unit: These might become smaller functions themselves but in the end The step validate columns names consists of adjustments of column types and adding columns. That adding part could be tricky: you add new columns based on the temporary table. We should be able to use the results from the data sampling, though, so this must not be part of Executing pre-sql doesn't have to be changed, I think. This is just running the statement and does not depend on the temporary table. I think I'll have to start playing around a bit before I see how this changes the actual part where you write to the target table. |
+1 on this as we have a restriction wherein we cannot create tables in the target database. Would value a method to avoid creating a temp table and perform a direct insert/truncate insert. |
This would only apply to
snapshot
mode, orincremental
mode with onlyupdate_key
(noprimary_key
).See #33 (comment) for more details.
Changes needed in WriteToDb:
SLING_ALLOW_DIRECT_INSERT=TRUE
.snapshot
orincremental
mode with onlyupdate_key
.DirectInsertAllowed()
PreSQL
is executed before direct insert. Currently, is executed after successful insert into temp tableWriteToDb
a bit for easier readThe text was updated successfully, but these errors were encountered: