Skip to content

Commit e7e28e8

Browse files
authored
Adding ClickHouse to autocommit blacklist
1 parent 1c58773 commit e7e28e8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/sql/run.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,11 @@ def run(conn, sql, config, user_namespace):
304304
txt = sqlalchemy.sql.text(statement)
305305
result = conn.session.execute(txt, user_namespace)
306306
try:
307-
# mssql has autocommit
308-
if config.autocommit and ('mssql' not in str(conn.dialect)):
307+
# some dialects have autocommit
308+
# specific dialects break when commit is used:
309+
dialects_blacklist = ('mssql', 'clickhouse')
310+
if config.autocommit \
311+
and all(dialect not in str(conn.dialect) for dialect in dialects_blacklist):
309312
conn.session.execute('commit')
310313
except sqlalchemy.exc.OperationalError:
311314
pass # not all engines can commit

0 commit comments

Comments
 (0)