简体   繁体   English

BigQuery - 查询以查找指定数据集或所有数据集的组和成员

[英]BigQuery - query to find what groups and members of those for a specified dataset or all datasets

I'm incredibly new to BigQuery.我对 BigQuery 非常陌生。 I'm on a mission to document who has access to each of our datasets.我的任务是记录谁有权访问我们的每个数据集。 The manual way of copying and pasting group names and then members of that group into a google sheets document would take a very long time and seems unnecessary.将组名和该组的成员复制并粘贴到 google 表格文档中的手动方式会花费很长时间,而且似乎没有必要。 I have to believe there is a way to query a dataset to find this information.我不得不相信有一种方法可以查询数据集来找到这些信息。

Would anyone have any suggestions for something like this?有人会对这样的事情有什么建议吗? Select datasetName, group, groupMember, roles from x where datasetName = "myDataSet" Select datasetName, group, groupMember, roles from x 其中datasetName = "myDataSet"

TIA! TIA!

Actually, Bigquery doesn't bring any way to approach this via standard/legacy SQL language statements as IAM ( Identity and Access Management ) related information is not promoted/published across Bigquery data volumes, in fact not included in INFORMATION_SCHEMA metadatainventory , thus you can't write a query that simply fetches this data.实际上,Bigquery 没有通过标准/遗留 SQL 语言语句来解决此问题,因为IAM身份和访问管理)相关信息未在 Bigquery 数据卷中推广/发布,实际上不包含在INFORMATION_SCHEMA元数据清单中,因此您无法编写仅获取此数据的查询。

In particular, you can use bq command-line tool, this Python binary leverages interaction with Biqquery API , that might give a chance to explore Dataset related information, including the access control entries.特别是,您可以使用bq 命令行工具,这个 Python 二进制文件利用与Biqquery API的交互,这可能提供探索数据集相关信息的机会,包括访问控制条目。 Given said this, focusing on bq show command you can write the plain bash loop fetching up the dataset metadata along the particular GCP project:鉴于此,专注于bq show命令,您可以编写简单的 bash 循环来获取特定 GCP 项目中的数据集元数据:

my_project="<Project_ID>";ds=$(bq ls --project_id=$my_project | awk '{print $1}' | tail +3); for ds in $ds; do bq show $my_project:$ds; done

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM