Skip to content

Commit d7ed5e1

Browse files
mathiasritterhashhar
authored andcommitted
Remove Context.should_autocommit Check
In the do_execute function of SQLAlchemy dialect, an if statement was accessing context.should_autocommit. This property has been removed in SQLAlchemy 2.0. To fix, the if statement can simply be removed as it is no longer needed.
1 parent 29bf762 commit d7ed5e1

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

trino/sqlalchemy/dialect.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -363,11 +363,6 @@ def do_execute(
363363
self, cursor: Cursor, statement: str, parameters: Tuple[Any, ...], context: DefaultExecutionContext = None
364364
):
365365
cursor.execute(statement, parameters)
366-
if context and context.should_autocommit:
367-
# SQL statement only submitted to Trino server when cursor.fetch*() is called.
368-
# For DDL (CREATE/ALTER/DROP) and DML (INSERT/UPDATE/DELETE) statement, call cursor.description
369-
# to force submit statement immediately.
370-
cursor.description # noqa
371366

372367
def do_rollback(self, dbapi_connection: trino_dbapi.Connection):
373368
if dbapi_connection.transaction is not None:

0 commit comments

Comments
 (0)