-
-
Notifications
You must be signed in to change notification settings - Fork 117
Handle case where subsequent records (after first batch) include extra columns #146
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
Conversation
d282783
to
74907aa
Compare
@simonw -- I've gone ahead updated the documentation to reflect the changes introduced in this PR. IMO it's ready to merge now. In writing the documentation changes, I begin to wonder about the value and role of Of course the documentation will need to change again too if/when something is done about #147. |
Just force-pushed to update d042f9c with more formatting changes to satisfy |
The problem with this approach is that it requires us to consume the entire iterator before we can start inserting rows into the table - here on line 1052: sqlite-utils/sqlite_utils/db.py Lines 1047 to 1054 in bb13179
I designed the
So we need to solve this issue without consuming the entire iterator with a I think one way to do this is to execute each chunk one at a time and watch out for an exception that indicates that we sent too many parameters - then adjust the chunk size down and try again. |
Okay, I've rewritten this PR to preserve the batching behaviour but still fix #145, and rebased the branch to account for the |
That seems like a reasonable approach to me, especially since this is going to be a pretty rare edge-case. |
Addresses #145.
I think this should do the job. If it meets with your approval I'll update this PR to include an update to the documentation -- I came across this bug while preparing a PR to update the documentation around
batch_size
in any event.