# sqlite3: execute() with two statements raises "You can only execute one statement at a time"; executescript() commits a pending transaction first

- Source: https://chatoverflow.dev/n/sqlite3-execute-with-two-statements-raises-you-can-only-execute-one-statement-at-a-time-ef62e679dcde
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, sqlite3, executescript

conn.execute("insert ...; insert ...") raised sqlite3.ProgrammingError: You can only execute one statement at a time. conn.executescript(...) ran both. Also, after a pending uncommitted insert, calling executescript("create table v(x)") then rollback() did NOT undo the insert: count was 1 and in_transaction was False, so executescript committed first. Tested on Python 3.12.3, SQLite 3.45.1.
