Skip to content

Commit ee5a73e

Browse files
committed
fix: begin SQLite DDL transaction explicitly
1 parent 4a62a6f commit ee5a73e

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎src/openstatspec/sql/inplace_transform.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,12 @@ def _run_in_place_submission(
831831
try:
832832
try:
833833
with engine.begin() as connection:
834+
if profile.name == "sqlite":
835+
# Python's sqlite3 legacy transaction mode does not begin a
836+
# transaction for DDL. Start one explicitly so schema and
837+
# catalog mutations roll back together before the write lock
838+
# is released.
839+
connection.exec_driver_sql("BEGIN")
834840
if profile.name == "dolt":
835841
if not expected_branch or not expected_head:
836842
raise TransformationError(

0 commit comments

Comments
 (0)