Skip to content

can not get error logs when running with async_=True #482

Open
@huwngnosleep

Description

@huwngnosleep

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions