apache / apache/arrow-adbc

Python/adbc_driver_manager: Do not commit by default on executescript

Open
#3,559 4 comments 0 reactions 0 assignees View on GitHub
Type: enhancement
Dominant language
C#
Stars
627
Forks
217
Avg merge
17h
Merged PRs (30d)
57

Description

### What feature or improvement would you like to see?

Currently, executescript is the best way to run complex DDL that adbc_driver_manager offers, but it suffers from having an issue:

you cannot do the following snippet(pseudocode) correctly in adbc_driver_manager, because executescript commits by default, and thus nothing is rolled back in case only the last one fails

```Python
ddl_list=["first.sql","second.sql","lastone.sql"]
conn=adbcdrivermanagerpostgres conn
with conn.cursor() as cur:
cur.execute("BEGIN;")
try:
for ddl in ddl_list:
cur.executescript(ddl)
except Exception:
cursor.execute("ROLLBACK;")
else:
cursor.execute("COMMIT;")
```

Expected behavior is that executescript does not commit by default at all, or has a flag to disable such behavior

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.