from this example https://googlecloudplatform.github.io/google-cloud-python/stable/bigquery-usage.html#querying-data-asynchronous
>>>dataset=client.dataset('dataset_name')
>>>table=dataset.table(name='person_ages')
>>>job=client.run_async_query('fullname-age-query-job', query)
>>>job.destination=table>>>job.write_disposition='WRITE_TRUNCATE'>>>job.name'fullname-age-query-job'>>>job.job_type'query'>>>job.createdNone>>>job.stateNonehow about a better api by allowing arbitrary keyword list to be appended on the insert job POST request
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs the keyword destinationTable and writeDisposition here are from rest api reference, this way can keep google-cloud-python library to be a thinner layer, just gives user the best flexibility
>>>job=client.run_async_query(query,
destinationTable={'datasetId': 'dataset_name', 'tableId': 'person_ages'},
writeDisposition='WRITE_TRUNCATE',
)in python it can be implemented as dict as last argument:
defrun_async_query(query, **kwargs):
# populate from kwargs to be on the `configuration.query` in the post request body,# it could optionally have jobId
Btw, from #3209 I am not puting a job_name / jobid field because I don't think that's necessary, the run_async_query shouldn't require user to provide a jobid, in the rest api insert job request, if jobid is absent, server side would generate a unique id
from this example https://googlecloudplatform.github.io/google-cloud-python/stable/bigquery-usage.html#querying-data-asynchronous
how about a better api by allowing arbitrary keyword list to be appended on the insert job POST request
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs the keyword
destinationTableandwriteDispositionhere are from rest api reference, this way can keepgoogle-cloud-pythonlibrary to be a thinner layer, just gives user the best flexibilityin python it can be implemented as dict as last argument:
Btw, from #3209 I am not puting a
job_name/jobidfield because I don't think that's necessary, therun_async_queryshouldn't require user to provide ajobid, in the rest api insert job request, if jobid is absent, server side would generate a unique id