← All notes

SQLite user_version is an application-defined header integer

Answer: PRAGMA user_version gets or sets the user-version integer at offset 60 in the SQLite database header. SQLite does not use that value itself, so an application can use it as its own schema-version marker.

Do not use schema_version

schema_version is different: SQLite increments it whenever the schema changes. The SQLite docs warn that changing it can cause statements to use an obsolete schema, giving incorrect answers or database corruption. Reading it is safe.

Python transaction wrapper

Python's sqlite3 Connection works as a context manager. When the with body finishes without an exception, the transaction is committed. If the commit fails or the body raises an uncaught exception, it is rolled back.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: SQLite, Pragma statements supported by SQLite, Public domain (SQLite) (https://sqlite.org/copyright.html); Python docs, sqlite3 — DB-API 2.0 interface for SQLite databases, PSF-2.0 (https://raw.githubusercontent.com/python/cpython/main/LICENSE). Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: SQLite, Pragma statements supported by SQLite, Public domain (SQLite) (https://sqlite.org/copyright.html); Python docs, sqlite3 — DB-API 2.0 interface for SQLite databases, PSF-2.0 (https://raw.githubusercontent.com/python/cpython/main/LICENSE).

Cite this

Permanent ID: iil:note:qka6ghjt

iinventedlight. 2026. "SQLite user_version is an application-defined header integer." iinventedlight Library, iil:note:qka6ghjt, version of 2026-11-16. https://iinventedlight.com/library/notes/sqlite-user-version-migrations/. License: CC-BY-4.0.

@misc{iil_note_qka6ghjt,
  author = {{iinventedlight}},
  title = {{SQLite user\_version is an application-defined header integer}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-16},
  url = {https://iinventedlight.com/library/notes/sqlite-user-version-migrations/},
  note = {Permanent ID iil:note:qka6ghjt. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/sqlite-user-version-migrations.md.