[Python] Is there a ReadSessionAsync or similar in BigQuery Storage Python API

Discussão em 'Python' iniciado por Stack, Junho 16, 2025.

  1. Stack

    Stack Membro Participativo

    My (working) code roughly does the following:

    read_session = bigquery_storage.ReadSession(...)
    request = bigquery_storage.CreateReadSessionRequest(...)
    session = client.create_read_session(request=request)
    iterator = [client.read_rows(stream.name).rows(session) for stream in session.streams][0]
    # and here I can nicely iterate over the rows...


    However, I hate about the code that it is blocking.

    I discovered in the docs that a BigQueryReadAsyncClient has a async create_read_session as a drop-in replacement of the same-named call in the snippet above (link to docs). Unfortunately, according to the docs, this still returns a regular ReadSession without any async methods.

    Am I overlooking something? Is there a nice, async way to lazily iterate over the rows of a bigquery table / query result with some async buffer? Seems like a reasonably standard use case thus I wonder what I am missing.

    Continue reading...

Compartilhe esta Página