trinodb / trinodb/trino-python-client
Improve cursor close and connection close behaviour
Open
@damian3031 is already working on this.
Since Feb 27, 2025.
enhancement
- Dominant language
- Python
- Stars
- 439
- Forks
- 206
- PR merge metrics
- No merged PRs in 30d
Description
From https://github.com/trinodb/trino-python-client/pull/405#issuecomment-1705226919
In my head the logic should be:
- On
cursor.close()
- Cancel any already executing queries if they exist
- Perform implicit ROLLBACK if within a transaction
- Set some boolean so that calling any method of the
cursorleads toErrorWe don't do steps 2 and 3 here (both required by DB-API).
- On
cursor.cancel()- this is not a DB-API specified method so the behaviour is up to us to specify
- Cancel any already executing queries
- If query already finished, return False
- If query is running and was cancelled successfully, return True
- If no query was executed at all (how to differentiate between this and already finished? - presence of query on the cursor?) then raise Exception
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.