Problem:
There isn't an easy way to fetch the row results of a client.run_async_query(job_id, query) call.
I have to do some yucky stuff to get it to work in a sample I'm working on.
client = bigquery.Client()
query_job = client.run_async_query(str(uuid.uuid4()), query)
query_job.use_legacy_sql = False
query_job.begin()
wait_for_job(query_job)
query_results = bigquery.query.QueryResults('', client)
query_results._properties['jobReference'] = {
'jobId': query_job.name,
'projectId': query_job.project
}
Possible Solutions:
- Modify constructor for QueryResults or add a class function to take an optional job object.
- Add a method to QueryJob
get_query_results() that does this same yuckiness (modifying the internal _properties)
I'm sure there are other solutions, too, which is why I'm asking for input rather than going off and trying to fix right away.
Reference:
Problem:
There isn't an easy way to fetch the row results of a
client.run_async_query(job_id, query)call.I have to do some yucky stuff to get it to work in a sample I'm working on.
Possible Solutions:
get_query_results()that does this same yuckiness (modifying the internal_properties)I'm sure there are other solutions, too, which is why I'm asking for input rather than going off and trying to fix right away.
Reference: