首页 > 解决方案 > Bigquery - 在视图类型的表上浏览表数据

问题描述

我想使用 BigQuery 的预览/头部功能免费查看表的示例数据,如此处所述,为此我尝试使用此处列出的python api

from google.cloud import bigquery

# Construct a BigQuery client object.
client = bigquery.Client()

# TODO(developer): Set table_id to the ID of the table to browse data rows.
# table_id = "your-project.your_dataset.your_table_name"

# Download all rows from a table.
rows_iter = client.list_rows(table_id)  # Make an API request.

# Iterate over rows to make the API requests to fetch row data.
rows = list(rows_iter)

这导致:

BadRequest: 400 GET https://bigquery.googleapis.com/bigquery/v2/projects/your-project/datasets/your_dataset/tables/your_table_name/data?formatOptions.useInt64Timestamp=True&prettyPrint=false: Cannot list a table of type VIEW.

有没有办法预览类型视图的表格?

还有其他免费的选择吗?

标签: google-bigquery

解决方案


我假设您可以将视图的内容写入临时表并链接到该临时表。这不是我同意的最干净的解决方案。

博士


推荐阅读