Skip to content

docs: document SQLite batch migrations with views - #1862

Open
Ryota-Di wants to merge 1 commit into
sqlalchemy:mainfrom
Ryota-Di:docs-sqlite-batch-views
Open

docs: document SQLite batch migrations with views#1862
Ryota-Di wants to merge 1 commit into
sqlalchemy:mainfrom
Ryota-Di:docs-sqlite-batch-views

Conversation

@Ryota-Di

@Ryota-Di Ryota-Di commented Sep 1, 2026

Copy link
Copy Markdown

This project accepts pull requests only for issues that a maintainer has
marked with the open for pull requests label.

A pull request that doesn't reference such an issue is closed
automatically
. That isn't a judgment on your change: it's how we settle on
an approach before anyone spends time writing code, and how we keep two
people from doing the same work at once.

The issue you reference has to be:

  • in this repository,
  • open,
  • labeled open for pull requests, and
  • not already labeled code review in progress, which means someone is
    working on it already.

If there's no such issue yet, open one describing the problem or the feature,
including a complete, runnable example, and wait for a maintainer to add the
label. Please don't open a pull request first and ask for the label
afterwards.

Fixes

Fixes: #1207

Description

Documents a SQLite limitation when using batch migrations with views that
reference the table being recreated.

During the "move and copy" workflow, the original table is temporarily
dropped before the replacement table is renamed. SQLite may reject the
rename when an existing view still refers to the temporarily missing table.

The documentation also notes that temporarily enabling
PRAGMA legacy_alter_table while the replacement table is renamed can be
used as a workaround.

Verification:

  • git diff --check
  • Sphinx documentation build with warnings treated as errors
  • Reproduced the failure locally with SQLite 3.53.1
  • Verified that temporarily enabling PRAGMA legacy_alter_table allows the
    batch migration to complete and leaves the referencing view usable

@sqla-tester

Copy link
Copy Markdown
Collaborator

Thanks! Issue #1207 is now marked code review in progress and no longer open for pull requests, so this pull request holds the review for it and another one won't land on top of your work. If this pull request is abandoned, a maintainer can put open for pull requests back on #1207 to reopen it to others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Running alter table revisions w/batch operations on SQLite raises an error if table referenced in a view

2 participants