-
Notifications
You must be signed in to change notification settings - Fork 197
Description
Describe the feature
SQLAlchemy 2.0 is currently in beta. I tried to use the trino dialect with it, but it errors when trying to access context.should_autocommit in this bit of the implementation:
trino-python-client/trino/sqlalchemy/dialect.py
Lines 366 to 370 in eef6388
| if context and context.should_autocommit: | |
| # SQL statement only submitted to Trino server when cursor.fetch*() is called. | |
| # For DDL (CREATE/ALTER/DROP) and DML (INSERT/UPDATE/DELETE) statement, call cursor.description | |
| # to force submit statement immediately. | |
| cursor.description # noqa |
The attribute should_autocommit of DefaultExecutionContext was removed in 2.0, as one of the maintainers answered to a question I asked on the SQLAlchemy repository: sqlalchemy/sqlalchemy#8854 (comment)
They also suggested that the current implementation seems a bit strange and should be re-visited. I don't have much expertise with dialects in general, so I'm creating this issue for now. I'm also willing to submit a PR if someone can explain in more detail what the purpose of that if statement is.
Describe alternatives you've considered
Alternative: Not using 2.0 - but 2.0 will be out of beta eventually so the dialect should be updated.
Are you willing to submit PR?
- Yes I am willing to submit a PR!