SQLAlchemy and Alembic failures: preserve local data before changing anything
Separate missing libraries, database access and migration state without deleting the database.
Separate three concerns
SQLAlchemy is a database toolkit. Alembic documents migration environments and revision-based upgrades.12 We recommend treating Python imports, database access and migration state as separate checks.
python -m pip show SQLAlchemy alembic
First identify whether the database belongs to ComfyUI, a node or the launcher. Preserve its application version and backup procedure. Do not share a password-bearing connection string. A copy of a live database file is not automatically a recoverable backup.
For a missing library, follow the application's dependency requirements. For an access error, inspect the target and process permissions. For a missing revision, check that application code and migration files belong together. Do not use stamp head as a replacement for executing required migrations.
This guide does not assume the database is disposable. Test the documented recovery path on a copy and confirm that existing records remain readable before testing new writes. A successful command exit alone is not evidence that user data survived correctly.
Related checks
- Keep a reproducible ComfyUI repair record without exposing secrets
- Where to run ComfyUI commands: PowerShell, CMD and virtual environments
Research draft. No local/GPU reproduction or independent editorial sign-off. Upstream statements and our recommendations are distinguished.
Was this page helpful?
Anonymous. Only a yes/no counter is stored; no account, IP address or device details.
Sources & references
Research draft. No local/GPU reproduction or independent editorial sign-off. Upstream statements and our recommendations are distinguished.
01SQLAlchemy installation overviewSource checked: 2026-09-2102Alembic migration tutorialSource checked: 2026-09-21