Repository navigation
Fix --truncate for empty inserts - #937
Closed
xiexqian-stack wants to merge 1 commit into
Closed
xiexqian-stack wants to merge 1 commit into
xiexqian-stack wants to merge 1 commit into
Conversation
Owner
|
Fixed in: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #935
insert_all([], truncate=True)and the CLI'sinsert --truncatereturned before the truncate step, leaving existing rows in place. The same happened for an empty generator, a header-only list, an empty JSON array, and a header-only CSV.The empty-input paths now call
delete_where(), which is a no-op when the table does not exist and keeps the existing schema. Non-empty inserts continue to use the same truncate path as before.Tests added for empty list, empty generator, header-only list, empty JSON via the CLI, and header-only CSV via the CLI.
PYTHONUTF8=1 python -m pytest -qreports1502 passed, 16 skipped.📚 Documentation preview 📚: https://sqlite-utils--937.org.readthedocs.build/en/937/