查询 INFORMATION_SCHEMA.COLUMNS 时权限 bigquery.tables.updateData 被拒绝

Permission bigquery.tables.updateData denied when querying INFORMATION_SCHEMA.COLUMNS

我正在使用具有以下角色的服务帐户查询 bigquery(通过数据块):

BigQuery Data Viewer
BigQuery Job User
BigQuery Metadata Viewer
BigQuery Read Session User

查询是:

SELECT distinct(column_name) FROM `project.dataset.INFORMATION_SCHEMA.COLUMNS` where data_type = "TIMESTAMP" and is_partitioning_column = "YES"

我实际上是通过 Azure Databricks 进行查询:

  spark.read.format("bigquery")
  .option("materializationDataset", dataset)
  .option("parentProject", projectId)
  .option("query", query)
  .load()
  .collect()

但我得到:

  "code" : 403,
  "errors" : [ {
    "domain" : "global",
    "message" : "Access Denied: Table project:dataset._sbc_f67ac00fbd5f453b90....: Permission bigquery.tables.updateData denied on table project:dataset._sbc_f67ac00fbd5f453b90.... (or it may not exist).",
    "reason" : "accessDenied"
  } ],

添加 BigQuery Data Editor 后查询有效。 为什么我需要写入权限才能查看此元数据?我可以授予更低的权限吗?

我在文档中看到 only data viewer is required,所以我不确定我做错了什么。

如果未指定特定 table 名称,BigQuery 会将所有查询结果保存到临时 table。

来自 document,需要以下权限。

  • bigquery.tables.create permissions to create a new table

  • bigquery.tables.updateData to write data to a new table, overwrite a table, or append data to a table

  • bigquery.jobs.create to run a query job

由于服务帐户已经具有 BigQuery Job User 角色,它能够 运行 查询,它需要 BigQuery Data Editor 角色 bigquery.tables.createbigquery.tables.updateData权限。