Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

feature request: better api for arbitrary keyword argument pass to query ? #3210

Copy link
Copy link
@c0b

Description

@c0b
Issue body actions

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.created
None
>>> job.state
None

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 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:

def run_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

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the BigQuery API.Issues related to the BigQuery API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.