PyHive icon indicating copy to clipboard operation
PyHive copied to clipboard

can not get error logs when running with async_=True

Open huwngnosleep opened this issue 7 months ago • 1 comments

I am running pyhive cursor.execute with async_=True, but when my query got error and I tried to get error message with cursor.fetch_logs() it returned an empty list. Did i do anything wrong, here is my code:

cursor.execute(sql_query, async_=True)

while True:
    # Get operation status
    status_code = cursor.poll().operationState
    status_name = OPERATION_STATES.get(status_code, f'UNKNOWN_STATE_{status_code}')
    
    _logger.info("Query status: %s", status_name)
    
    if status_code in [2, 3, 4]:
        _logger.info("Query completed with status: %s", status_name)
        break
    elif status_code == 5:
        error_message = cursor.fetch_logs()
        _logger.info("Query failed with error: %s", error_message)
        raise Exception(f"Query failed: {error_message}")

huwngnosleep avatar Mar 26 '25 07:03 huwngnosleep