-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
possible bug in start_transaction (dbapi.py) #129
Comments
Thanks for rising the issue. Would the suggested solution solve the issue when a transaction is executed > 5 min? I wonder how setting separate isolation level for @hashhar / @ebyhr / @findinpath any ideas? |
Correct. From my understanding there are two issues here:
|
@hovaesco we did not test the case so it is just a suggestion. The reason I mentioned about isolation level is here
With correct isolation level, the request instance might be used correctly
|
Thanks @hashhar and @bachng2017 for the explanation. I'm starting to work to address this issue. |
Closed by: #152 |
Issue:
start_transaction()
(dbapi.py) might need to set the isolation level properly.Details:
Currently the start_transaction does not change the isolation level (#b), while cursor() only compare the isolation level with AUTO_COMMIT(#a). The result is that the transaction and the query uses different
request instance
and runindependently
(perhaps)trino-python-client/trino/dbapi.py
Line 130 in c8144de
For some application (likes dbt), the following sequence is heavily used:
If the query finishes within the transaction-timeout, everything looks fine. If the query succeed but took a longer time than transaction-timeout (default is 5 min), error will happen at 3 likes below. Note that in this case, the query succeed and the result is recorded (because it seems to run with auto_commit enabled sessions)
Expectation:
It might depend on the spec or definition of transaction-timeout, but expectation is that there is no error in the above mentioned case.
Suggested solution:
Maybe
start_transaction
should have the option to set isolation level (with REPEATABLE_READ as default). And commit()/rollback() need to set the isolation level back to the value it is set when connection is initialized.The text was updated successfully, but these errors were encountered: