將 DeleteDataset 與 AWS SDK 搭配使用 - AWS SDK 程式碼範例

AWS文件開發套件範例 GitHub 儲存庫中有更多可用的 AWS SDK 範例。

DeleteDataset 與 AWS SDK 搭配使用

以下程式碼範例顯示如何使用 DeleteDataset

如需詳細資訊,請參閱刪除資料集

Python
SDK for Python (Boto3)
注意

GitHub 上提供更多範例。尋找完整範例,並了解如何在 AWS 程式碼範例儲存庫中設定和執行。

class Datasets: @staticmethod def delete_dataset(lookoutvision_client, project_name, dataset_type): """ Deletes a Lookout for Vision dataset :param lookoutvision_client: A Boto3 Lookout for Vision client. :param project_name: The name of the project that contains the dataset that you want to delete. :param dataset_type: The type (train or test) of the dataset that you want to delete. """ try: logger.info( "Deleting the %s dataset for project %s.", dataset_type, project_name ) lookoutvision_client.delete_dataset( ProjectName=project_name, DatasetType=dataset_type ) logger.info("Dataset deleted.") except ClientError: logger.exception("Service error: Couldn't delete dataset.") raise
  • 如需 API 詳細資訊,請參閱《AWS SDK for Python (Boto3) API 參考》中的 DeleteDataset