Skip to content

Response from table update is incompatible with Google's Python SDK #293

@mastizada

Description

@mastizada

What happened?

When table schema is updated, it calls BigQuery.updateTable with PATCH method. With bigquery-emulator, it is returning the updated schema, however, google-cloud-bigquery plugin expects tableReference with tableId in the response. Link to the plugin function.

What did you expect to happen?

To have [tableReference][tableId] in the response.

How can we reproduce it (as minimally and precisely as possible)?

Install the python plugin: $ pip install google-cloud-bigquery (tested on latest version, 3.20.1, and old version 2.34.3).

Execute the following code:

from google.auth.credentials import AnonymousCredentials
from google.cloud import bigquery

client = bigquery.Client(client_options={"api_endpoint": "http://0.0.0.0:9050"}, credentials=AnonymousCredentials())

# change project id, dataset name and table name
table_ref = ".".join([GCP_PROJECT_ID, DATASET_NAME, TABLE_NAME])
table = client.get_table(table_ref)

# slightly modify `table.schema`
table = client.update_table(table, ["schema"])

It will give the following error:
KeyError: 'Resource lacks required identity information:["tableReference"]["tableId"]'

Anything else we need to know?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions