Repository navigation
Prevent table names from colliding in dump filenames - #17
Open
vibhor-aggr wants to merge 1 commit into
Open
vibhor-aggr wants to merge 1 commit into
vibhor-aggr wants to merge 1 commit into
Conversation
This branch has not been deployed
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 #1.
With tables named
foo/barandfoobar,dump --allsucceeds on 0.6 but writes just one pair of files. One table silently overwrites the other. This change givesfoo/barthe stemfoo%2Fbar, leavesfoobarunchanged, and escapes a literalfoo%2Fbarasfoo%252Fbar. The name doesn't depend on which other tables are being dumped. Spaces and ordinary Unicode are preserved; very long stems use a reserved hash prefix.The loader still gets the table name from metadata. It now strips only the final metadata suffix, so names such as
sales.metadataround-trip too. Existing unambiguous dumps remain readable. An old dump that already lost a table to a collision must be regenerated from the original database; dumping doesn't delete obsolete files.Verification: 10 behavior tests passed on CPython 3.12 and 3.14, each with sqlite-utils 3.39.1 and 4.2.2. The Black-only test was excluded locally (marked to skip on these interpreters). In an independent CLI replay, seven tables retained their exact schema SQL, keys and values; subset and full dumps agreed byte-for-byte, and the new loader restored a dump written by the old code. Fixture dumps using all 20 table names in the README's linked backup had identical filenames and contents before and after. No backup data was downloaded.
Prepared and tested with Codex assistance.