Repository navigation
Align SQLite row values with their column names - #86
Merged
Merged
Conversation
xrotwang
approved these changes
Oct 24, 2026
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.
Database.writetakes column names from the first row, but takes each later row's values in that dictionary's insertion order. This silently swaps values when otherwise equivalent dictionaries have different key orders:This prints
{'ID': 'water', 'Form': '2'}; it should print{'ID': '2', 'Form': 'water'}.Collect converted values by column name, then emit them in the first row's column order. Reject rows with different column sets so an extra or missing field cannot be silently discarded or assigned to another column.
Four regressions fail before the change and pass after. The full suite passes on Python 3.12 (829 passed, 16 expected failures) and 3.9 (832 passed, 13 expected failures); Flake8 passes for the changed files. A recorded lexical-data round trip also preserves all 1,514 rows through memory/file databases, translated column names and CSV export. Previously, alternating dictionary orders corrupted 757 rows and rotating orders corrupted 1,135; stable-order controls remain identical.