Fix #705: Clarify ensure_autocommit_off() naming and documentation#708
Open
RamiNoodle733 wants to merge 2 commits intosimonw:mainfrom
Open
Fix #705: Clarify ensure_autocommit_off() naming and documentation#708RamiNoodle733 wants to merge 2 commits intosimonw:mainfrom
RamiNoodle733 wants to merge 2 commits intosimonw:mainfrom
Conversation
added 2 commits
February 7, 2026 14:12
When inserting a CSV file that contains only a header row (no data rows), the --detect-types option would crash with an AssertionError because it tried to transform a table that didn't exist. This fix adds a check to ensure the table exists before attempting to apply type transformations. The fix is applied in two places: 1. insert_upsert_implementation() for the insert command 2. memory() command for CSV/TSV files Added test case: test_insert_csv_headers_only
The function name ensure_autocommit_off() was confusing because it sets isolation_level = None, which actually ENABLES autocommit mode in SQLite, not disables it. Changes: - Add new ensure_autocommit_on() method with correct name and docstring - Keep ensure_autocommit_off() as deprecated alias for backwards compatibility - Update internal usages (enable_wal(), disable_wal()) to use new method - Add warnings import for deprecation notice
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 #705
The function name
ensure_autocommit_off()was confusing because it setsisolation_level = None, which actually ENABLES autocommit mode in SQLite, not disables it.Changes
ensure_autocommit_on()method with correct name and accurate docstring explaining thatisolation_level = Noneenables autocommit modeensure_autocommit_off()- kept as alias for backwards compatibility withDeprecationWarningenable_wal(),disable_wal()) to use the new method namewarningsimport for the deprecation noticeBackwards Compatibility
Existing code using
ensure_autocommit_off()will continue to work but will emit aDeprecationWarningdirecting users to the new method name.📚 Documentation preview 📚: https://sqlite-utils--708.org.readthedocs.build/en/708/