databricks-sql-python icon indicating copy to clipboard operation
databricks-sql-python copied to clipboard

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

Open ganeshdogiparthi-db opened this issue 1 year ago • 0 comments

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}")

ganeshdogiparthi-db avatar Nov 19 '24 03:11 ganeshdogiparthi-db