-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
api: bigqueryIssues related to the BigQuery API.Issues related to the BigQuery API.
Description
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:
- QueryJob: https://github.com/GoogleCloudPlatform/gcloud-python/blob/master/gcloud/bigquery/job.py#L933
- QueryResults: https://github.com/GoogleCloudPlatform/gcloud-python/blob/master/gcloud/bigquery/query.py#L42
- Docs: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-python/master/docs/bigquery-usage.rst Notice the async query does not show fetching row results.
Metadata
Metadata
Assignees
Labels
api: bigqueryIssues related to the BigQuery API.Issues related to the BigQuery API.