简体   繁体   English

Google Cloud Function 无法删除 Bigquery 数据集

[英]Google Cloud Function Not able to delete Bigquery Dataset

I have created a cloud function which will list down all Bigquery datasets which are falling under certain criteria, and then delete all such Bigquery datasets.我创建了一个云 function,它将列出所有符合特定条件的 Bigquery 数据集,然后删除所有此类 Bigquery 数据集。 I am using following Delete API request:-我正在使用以下删除 API 请求:-

bigquery_client.delete_dataset(
dataset['schema_name'], delete_contents=True, not_found_ok=True
)  # Make an API request.

its giving following error:-它给出以下错误: -

fn_clean_bq_datasetrrhier7sk4oz Traceback (most recent call last): File "/layers/google.python.pip/pip/lib/python3.9/site-packages/flask/app.py", line 2073, in wsgi_app response = self.full_dispatch_request() 
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/flask/app.py", line 1518, in full_dispatch_request rv = self.handle_user_exception(e) File "/layers/google.python.pip/pip/lib/python3.9/site-packages/flask/app.py", line 1516, in full_dispatch_request rv = self.dispatch_request() 
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/flask/app.py", line 1502, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args) 
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/functions_framework/__init__.py", line 99, in view_func return function(request._get_current_object()) File "/workspace/main.py", line 76, in clean_bq_dataset bigquery_client.delete_dataset( 
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/google/cloud/bigquery/client.py", line 1571, in delete_dataset self._call_api( File "/layers/google.python.pip/pip/lib/python3.9/site-packages/google/cloud/bigquery/client.py", line 759, in _call_api return call() 
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/google/api_core/retry.py", line 283, in retry_wrapped_func return retry_target( File "/layers/google.python.pip/pip/lib/python3.9/site-packages/google/api_core/retry.py", line 190, in retry_target return target() 
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/google/cloud/_http/__init__.py", line 494, in api_request raise exceptions.from_http_response(response) google.api_core.exceptions.
Forbidden: 403 DELETE https://bigquery.googleapis.com/bigquery/v2/projects/xxxxxxxx/datasets/dataset_v05c248634?deleteContents=true&prettyPrint=false: Access Denied: Dataset xxxxxxxxx:dataset_v05c248634: Permission bigquery.datasets.delete denied on dataset xxxxxxxxxxx:dataset_v05c248634 (or it may not exist).

Please suggest what permissions are missing here on Google cloud function.请建议在谷歌云 function 上缺少哪些权限。

Required permissions 所需权限

To delete a dataset, you need the following IAM permissions:要删除数据集,您需要以下 IAM 权限:

bigquery.datasets.delete (lets you delete a dataset)
bigquery.tables.delete (lets you delete tables and views)

Each of the following predefined IAM roles includes the permissions that you need in order to delete a dataset:以下每个预定义 IAM 角色都包含您删除数据集所需的权限:

roles/bigquery.dataOwner
roles/bigquery.admin

Additionally, if you have the bigquery.datasets.create permission, you can delete the datasets and tables that you create.此外,如果您拥有 bigquery.datasets.create 权限,则可以删除您创建的数据集和表。

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

相关问题 Google Cloud DataStream to Bigquery 模板无法将数据同步到大查询 - Google Cloud DataStream to Bigquery template not able to sync data to big query 无法部署或删除谷歌云 function - Can't deploy or delete a google cloud function 将数据上传到 BigQuery 的 Google Cloud Function 的服务帐户角色 - Service account role for a Google Cloud Function that uploads data to BigQuery 谷歌云 Function 删除 Firestore 文件 - Google Cloud Function delete Firestore document 无法在 Airflow 2.0 中使用“from airflow.providers.google.cloud.operators.bigquery import BigQueryOperator” - Not being able to use 'from airflow.providers.google.cloud.operators.bigquery import BigQueryOperator' in Airflow 2.0 BigQuery 中的循环 (SQL - GOOGLE CLOUD) - Loop in BigQuery (SQL - GOOGLE CLOUD) Google Cloud 中的数据验证 - BigQuery - Data validation in Google Cloud - BigQuery 将 Bigquery function 与云功能连接起来 - Connect a Bigquery function with Cloud functions 计划在 BigQuery 上更新 Google Analytics 数据集 - Schedule update of Google Analytics dataset on BigQuery 通过使用 Sendgrid 事件 webhook 并将其存储在 Google Bigquery 表中,在 Google Cloud Function 中获取邮件明智状态时获取 BQError - Getting a BQError while fetching the mail wise status in Google Cloud Function by using Sendgrid event webhook and storing it in Google Bigquery table
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM