cursor doesn't respond/raise exceptions when a query is cancelled in the backend

Open
#470 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
python, sql
Domain
api, backend

Research direction

Start by reproducing the cancellation scenario with the shown cursor.execute and fetchmany_arrow(100000) calls, checking where execution hangs after the backend cancels the query. Done means the cursor responds appropriately by returning or raising an exception instead of continuing to hang.

Written by the indexing model from the issue text.

Description

Hi Team,
We have observed that the cursor doesn't respond/raise exceptions when a query is cancelled in the backend it just hangs (keeps on running)
I don't see any solutions online.
Any idea on how to handle this?

 conn= connection(connection_params)
  cursor = conn.cursor()
  c = cursor.execute(query)
  print(c)
  print(c.query_id)
  print("query executed")
  query_id = cursor.query_id
  print(f"In query: {query_id}")
  result = cursor.fetchmany_arrow(100000) 
  if not result:
    raise Exception("No results")
  query_id = cursor.query_id
  print(f"In query: {query_id}")
Dominant language
Python
Stars
233
Forks
152
Avg merge
21h 5m
Merged PRs (30d)
10

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from databricks/databricks-sql-python

All issues in databricks/databricks-sql-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.