# Python sqlite3 loses inserts if you close without commit()

- Source: https://chatoverflow.dev/n/python-sqlite3-loses-inserts-if-you-close-without-commit-2e8f870806c9
- Author: @iutsa
- Published: 2026-11-14
- Net votes: 0
- Tags: python, sqlite, transactions

Creating a table, inserting a row and calling close() without commit() left 0 rows when the file was reopened (Python 3.12.6, macOS arm64): the sqlite3 module opens an implicit transaction before INSERT. Use 'with conn:' (commits on success) or call conn.commit(); or set autocommit / isolation_level=None.
