[英]Using external tables without granting access to GCS
We have 2 GCP projects project-a
and project-b
.我们有 2 个 GCP 项目project-a
和project-b
。 And we want to give access to some external tables in the first project to users in second project using Authorized Views.我们希望使用授权视图向第二个项目中的用户授予对第一个项目中某些外部表的访问权限。
Here's what we've done so far:这是我们到目前为止所做的:
project-a
(private dataset) as external tables from GCS parquet files在project-a
(私有数据集)中创建几个 BigQuery 表作为来自 GCS parquet 文件的外部表project-b
in which we created authorized views on the external tables from project project-a
在项目project-b
中创建一个数据集(公共数据集),其中我们在项目 project project-a
a 的外部表上创建了授权视图However if we give access to users in the project project-b
to query the public views they receive this error:但是,如果我们授予项目project-b
中的用户访问权限以查询公共视图,他们会收到此错误:
Access Denied: BigQuery BigQuery: Permission denied while globbing file pattern.访问被拒绝:BigQuery BigQuery:通配文件模式时权限被拒绝。
I know this means they should also have read permission on GCS buckets of project-a
but we can't grant this permission in GCS.我知道这意味着他们还应该对project-a
GCS 存储桶具有读取权限,但我们不能在 GCS 中授予此权限。
Is there a way to achieve this?有没有办法做到这一点? Or maybe another way of doing?或者,也许另一种方式做?
AFAIK, you must have the permission to access to the external data location to access the data (GCS, Google Sheet, or whatever are located the external data). AFAIK,您必须有权访问外部数据位置才能访问数据(GCS、Google 表格或位于外部数据的任何位置)。 There is no trick for that没有诀窍
This is now possible using BigLake tables .现在可以使用BigLake 表。 We simply need to create a connection resource in BigQuery then use it to define an external table.我们只需要在 BigQuery 中创建一个连接资源,然后使用它来定义一个外部表。 Users now only require access to BigQuery tables, no need to set permissions in data location (GCS here).用户现在只需访问 BigQuery 表,无需在数据位置(此处为 GCS)设置权限。
bq
command使用 cloud shell bq
命令创建连接bq mk --connection --location=REGION --project_id=PROJECT_ID \
--connection_type=CLOUD_RESOURCE CONNECTION_ID
bq show --connection PROJECT_ID.REGION.CONNECTION_ID
CREATE EXTERNAL TABLE `PROJECT_ID.DATASET.EXTERNAL_TABLE_NAME`
WITH CONNECTION `PROJECT_ID.REGION.CONNECTION_ID`
OPTIONS (
format ="TABLE_FORMAT",
uris = ['FILE_PATH']
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.