本页面介绍如何删除和获取与数据集相关的信息。
如需了解如何创建数据集并将数据导入其中,请参阅创建数据集并导入数据。
准备工作
您必须先按照准备工作所述设置项目,然后才能使用 AutoML Tables。
列出数据集
一个项目可以包含许多数据集。本部分介绍如何检索项目的可用数据集列表。
控制台
要使用 AutoML Tables 界面查看可用数据集列表,请点击左侧导航菜单顶部的数据集链接,然后选择区域。
REST
要列出数据集,请使用 datasets.list 方法。
在使用任何请求数据之前,请先进行以下替换:
-
endpoint:全球位置为
automl.googleapis.com
,欧盟地区为eu-automl.googleapis.com
。 - project-id:您的 Google Cloud 项目 ID。
- location:资源的位置:全球位置为
us-central1
,欧盟位置为eu
。
HTTP 方法和网址:
GET https://endpoint/v1beta1/projects/project-id/locations/location/datasets
如需发送请求,请选择以下方式之一:
curl
执行以下命令:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: project-id" \
"https://endpoint/v1beta1/projects/project-id/locations/location/datasets"
PowerShell
执行以下命令:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred"; "x-goog-user-project" = "project-id" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://endpoint/v1beta1/projects/project-id/locations/location/datasets" | Select-Object -Expand Content
您应该收到类似以下内容的 JSON 响应:
{ "name": "projects/29434381/locations/us-central1/datasets/TBL75559", "displayName": "test_dataset", "createTime": "2019-03-21T00:50:20.660378Z", "updateTime": "2019-08-23T19:32:52.025469Z", "etag": "AB3BwFoV4USmhM3pT8c6Y5AIA6n51dAmSuObc=", "exampleCount": 94356, "tablesDatasetMetadata": { "primaryTableSpecId": "16930321664", "targetColumnSpecId": "46579780096", "areStatsFresh": true, "targetColumnCorrelations": { "6788648672679690240": { "cramersV": 0.16511808788616378 }, "87292427152392192": { "cramersV": 0.20327159375043746 }, "2393135436366086144": { "cramersV": 0.15513206308654948 }, "9094491681893384192": { "cramersV": 0.021499396246101456 }, "7004821454793474048": { "cramersV": 0.030097587339321379 } }, "statsUpdateTime": "2019-08-16T01:43:38.583Z", "tablesDatasetType": "BASIC" } }, ...
Java
如果资源位于欧盟区域,您必须明确设置端点。了解详情。
Node.js
如果资源位于欧盟区域,您必须明确设置端点。了解详情。
Python
AutoML Tables 的客户端库包含其他 Python 方法,这些方法使用 AutoML Tables API 进行简化。这些方法按名称而不是 ID 来引用数据集和模型。您的数据集和模型的名称必须是唯一的。如需了解详情,请参阅客户端参考。
如果资源位于欧盟区域,您必须明确设置端点。了解详情。
删除数据集
删除数据集会将数据集从您的项目中永久移除。此操作不会删除根据该数据集创建的任何模型。如果想要删除模型,则必须明确删除它们。
控制台
在 AutoML Tables 界面中,点击左侧导航菜单顶部的数据集链接,然后选择区域以显示可用数据集的列表。
点击要删除的行最右侧的“更多操作”菜单,然后选择删除数据集。
在确认对话框中点击确认。
REST
要删除数据集,请使用 datasets.delete 方法。
在使用任何请求数据之前,请先进行以下替换:
-
endpoint:全球位置为
automl.googleapis.com
,欧盟地区为eu-automl.googleapis.com
。 - project-id:您的 Google Cloud 项目 ID。
- location:资源的位置:全球位置为
us-central1
,欧盟位置为eu
。 -
dataset-id:要删除的数据集的 ID。例如,
TBL6543
。
HTTP 方法和网址:
DELETE https://endpoint/v1beta1/projects/project-id/locations/location/datasets/dataset-id
如需发送请求,请选择以下方式之一:
curl
执行以下命令:
curl -X DELETE \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: project-id" \
"https://endpoint/v1beta1/projects/project-id/locations/location/datasets/dataset-id"
PowerShell
执行以下命令:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred"; "x-goog-user-project" = "project-id" }
Invoke-WebRequest `
-Method DELETE `
-Headers $headers `
-Uri "https://endpoint/v1beta1/projects/project-id/locations/location/datasets/dataset-id" | Select-Object -Expand Content
您应该收到类似以下内容的 JSON 响应:
{ "name": "projects/29452381/locations/us-central1/operations/TBL6543", "metadata": { "@type": "type.googleapis.com/google.cloud.automl.v1beta1.OperationMetadata", "createTime": "2019-12-26T17:19:50.684850Z", "updateTime": "2019-12-26T17:19:50.684850Z", "deleteDetails": {}, "worksOn": [ "projects/29452381/locations/us-central1/datasets/TBL6543" ], "state": "DONE" }, "done": true, "response": { "@type": "type.googleapis.com/google.protobuf.Empty" } }
删除数据集是一项长时间运行的操作。您可以轮询操作状态或等待操作返回。了解详情。
Java
如果资源位于欧盟区域,您必须明确设置端点。了解详情。
Node.js
如果资源位于欧盟区域,您必须明确设置端点。了解详情。
Python
AutoML Tables 的客户端库包含其他 Python 方法,这些方法使用 AutoML Tables API 进行简化。这些方法按名称而不是 ID 来引用数据集和模型。您的数据集和模型的名称必须是唯一的。如需了解详情,请参阅客户端参考。
如果资源位于欧盟区域,您必须明确设置端点。了解详情。