Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nothing maps to tables.update. update_table calls tables.patch #33

Closed
gavin-haynes-grow opened this issue Feb 7, 2020 · 3 comments
Closed
Assignees
Labels
api: bigquery Issues related to the googleapis/python-bigquery API. type: question Request for information or clarification. Not an issue.

Comments

@gavin-haynes-grow
Copy link

gavin-haynes-grow commented Feb 7, 2020

With python bigquery client v1.24.0

As noted in googleapis/google-cloud-python#4452

google.cloud.bigquery.client.Client.update_table does a patch (https://cloud.google.com/bigquery/docs/reference/rest/v2/tables/patch)

But nothing does an update (https://cloud.google.com/bigquery/docs/reference/rest/v2/tables/update)

This makes it hard to update a view.

As a workaround, I can do this:

table_ref = bq.Table("x.y.z")
table_ref.view_query = "SELECT 42"
table = bq.Table.from_api_repr(client._call_api(
        bq.DEFAULT_RETRY, method="PUT", path=table_ref.path, data=table_ref.to_api_repr()))

Can the client have a function like replace_table that will call this endpoint?

@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-bigquery API. label Feb 7, 2020
@tswast
Copy link
Contributor

tswast commented Feb 7, 2020

@shollyman I recall there was an issue with updating views via the API in the past? Did that ever get fixed for table.patch?

@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Feb 8, 2020
@plamut plamut added type: question Request for information or clarification. Not an issue. and removed 🚨 This issue needs some love. triage me I really want to be triaged. labels Feb 19, 2020
@meredithslota
Copy link
Contributor

The current limitations of views are described here: https://cloud.google.com/bigquery/docs/views-intro Here's how to update a view in Python: https://cloud.google.com/bigquery/docs/updating-views#python — do the code samples there help with your use case? Several of them were added since this ticket was filed.

@meredithslota
Copy link
Contributor

(Actually, since this issue is pretty old and code samples have been added in this space relatively recently, I'm gonna go ahead and close this but if this doesn't answer your question please reopen.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery API. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

6 participants