Skip to content

Commit d3540ca

Browse files
Merge branch 'patch-1' of git://github.com/feriat/ipython-sql into feriat-patch-1
2 parents 8cb9b1b + e7e28e8 commit d3540ca

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
@@ -309,8 +309,11 @@ def run(conn, sql, config, user_namespace):
309309
txt = sqlalchemy.sql.text(statement)
310310
result = conn.session.execute(txt, user_namespace)
311311
try:
312-
# mssql has autocommit
313-
if config.autocommit and ('mssql' not in str(conn.dialect)):
312+
# some dialects have autocommit
313+
# specific dialects break when commit is used:
314+
dialects_blacklist = ('mssql', 'clickhouse')
315+
if config.autocommit \
316+
and all(dialect not in str(conn.dialect) for dialect in dialects_blacklist):
314317
conn.session.execute('commit')
315318
except sqlalchemy.exc.OperationalError:
316319
pass # not all engines can commit

0 commit comments

Comments
 (0)