Clarify transform() behavior for indexes, views, and triggers - #896
Draft
ParsingMAINFRAME wants to merge 1 commit into
Draft
ParsingMAINFRAME wants to merge 1 commit into
ParsingMAINFRAME wants to merge 1 commit into
Conversation
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.
Refs #611.
The custom-transform documentation says transform() does not automatically
"upgrade" indexes, views, or triggers. That no longer explains the behavior:
indexes have been recreated since 3.38, and simple indexes on renamed columns
are supported in 4.2.
This documentation-only change explains the differences on current main:
It describes which index cases raise TransformError and when to recreate
indexes manually.
table when keep_table is used. Triggers attached elsewhere are unchanged.
It also explains how to append CREATE TRIGGER statements to transform_sql()
when renaming a column, and removes wording suggesting stale view references
are inherent to SQLite views. transform(rename=...) rebuilds the table;
SQLite's native ALTER TABLE ... RENAME COLUMN has different behavior.
Validation on macOS, Python 3.14.7 / SQLite 3.53.4, base 6bc1d33:
ty, Cog, and codespell passed.
before/after, including trigger loss, keep_table, stale references, index
rejection, and rollback after a failed unique-index recreation.
editable builds of both unchanged main and the patched source. An initial
editable-install failure was traced to a local cached .pth file carrying
macOS's hidden flag, which Python skips; it also failed on unchanged main
using that same affected cache artifact.
Small example of the trigger behavior:
AI assistance: OpenAI Codex helped investigate the behavior, draft the wording,
and run the checks.
📚 Documentation preview 📚: https://sqlite-utils--896.org.readthedocs.build/en/896/