SQLite
SQLite needs no server, no driver extra and no credentials — point DBLift at a file. DDL is transactional, so a failed migration leaves the file as it was.
type
sqlite
Driver
sqlite3 (stdlib)
DDL
Transactional
Default schema
main
Install
pip install dbliftConnection URL
sqlite:///app.dbThree slashes means a path relative to the working directory, four means absolute, and sqlite:///:memory: is in-memory. sqlite3 is an accepted alias for the type.
dblift.yaml
database:
type: sqlite
path: "./app.db"
schema: "main"
migrations:
directory: "./migrations"Engine settings
KeyDefaultEffect
path—The database file, or :memory:. Taken from path, then url, then database.schemamainSQLite's own default schema; set only if you attach another.username / password—Not required, and ignored when set.Behaviour notes
DDL is transactional.
A migration that fails half-way leaves the file untouched.
One file, one reading of the URL.
The URL is resolved by SQLAlchemy’s rule for both the engine and the direct sqlite3 connection, so they always address the same file.
ALTER TABLE is narrow.
Many column changes have to be written as an explicit table rebuild in the migration.
Drops use IF EXISTS.
DROP TABLE IF EXISTS is the generated form.