Skip to content

Python Cx_oracle need to skip long running queries and move on to execute next query #665

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

Closed
vbvasu opened this issue Feb 9, 2024 · 2 comments

Comments

@vbvasu
Copy link

vbvasu commented Feb 9, 2024

Hi,
Im trying to execute like 15-20 queries using cx_oracle python
Some of the queries may run long sometimes i am searching for a way to stop the query if its still running for more than 30 min i would like to skip this and cancel the execution and gopn executing other queries.
Is there anyway to track the time and cancel the query execution and skip this

Originally posted by @vbvasu in #173 (comment)

@vbvasu vbvasu changed the title Hi, Python Cx_oracle skipping long running queries and move on to execute next query Feb 9, 2024
@vbvasu vbvasu changed the title Python Cx_oracle skipping long running queries and move on to execute next query Python Cx_oracle need to skip long running queries and move on to execute next query Feb 9, 2024
@anthony-tuininga
Copy link
Member

You have a couple of options that immediately come to mind:

  • use the call_timeout attribute on connections to force a break after the timeout expires (results in an exception)

  • use a Python timer thread and then initiate a call to cancel the statement yourself (also results in an exception)

@cjbj
Copy link
Member

cjbj commented Apr 5, 2024

@vbvasu A side comment: don't forget to schedule your upgrade to the latest version of cx_Oracle, which was released under the new name python-oracledb a couple of years ago, see the release announcement

@cjbj cjbj closed this as completed Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants