[英]Batch delete BigTable tables and BigQuery datasets
我四处寻找一种方法来批量删除 BigTable 表和 BigQuery 数据集(使用 python 的库),到目前为止没有任何运气。
有人知道这样做的有效方法吗?
我查看了这些链接,但没有任何希望:
我正在从数据存储文档中寻找与此类似的内容:
from google.cloud import datastore
# For help authenticating your client, visit
# https://cloud.google.com/docs/authentication/getting-started
client = datastore.Client()
keys = [client.key("Task", 1), client.key("Task", 2)]
client.delete_multi(keys)
我认为这在本地是不可能的,你必须开发自己的脚本。
比如你可以配置所有表都删除,那么解决方法有很多:
Develop a Python
script, loop on the tables to delete and use Python Bigquery
and Bigtable
clients: https://cloud.google.com/bigquery/docs/samples/bigquery-delete-dataset https://cloud.google.com/ bigtable/docs/samples/bigtable-hw-delete-table
Develop a shell
script, loop on the tables to delete and use bq
and cbt
(from gcloud
sdk): https://cloud.google.com/bigquery/docs/managing-tables?hl=en#deleting_a_table https://cloud .google.com/bigtable/docs/cbt-reference?hl=fr
If it's possible on your side, you can also use Terraform
to delete multiple Bigquery
and Bigtable
tables, but it's more adapted if you need to manage a state for your infrastructure: https://registry.terraform.io/providers/hashicorp/google /latest/docs/resources/bigquery_table https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/bigtable_table
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.