Borra un conjunto de datos.
Muestra de código
Java
/**
* Delete a dataset.
*
* @param projectId the Google Cloud Project ID.
* @param computeRegion the Region name. (e.g., "us-central1").
* @param datasetId the Id of the dataset.
*/
public static void deleteDataset(String projectId, String computeRegion, String datasetId)
throws IOException, InterruptedException, ExecutionException {
// Instantiates a client
try (AutoMlClient client = AutoMlClient.create()) {
// Get the full path of the dataset.
DatasetName datasetFullId = DatasetName.of(projectId, computeRegion, datasetId);
// Delete a dataset.
Empty response = client.deleteDatasetAsync(datasetFullId).get();
System.out.println(String.format("Dataset deleted. %s", response));
}
}
Python
# TODO(developer): Uncomment and set the following variables
# project_id = 'PROJECT_ID_HERE'
# compute_region = 'COMPUTE_REGION_HERE'
# dataset_id = 'DATASET_ID_HERE'
from google.cloud import automl_v1beta1 as automl
client = automl.AutoMlClient()
# Get the full path of the dataset.
dataset_full_id = client.dataset_path(project_id, compute_region, dataset_id)
# Delete a dataset.
response = client.delete_dataset(name=dataset_full_id)
# synchronous check of operation status
print("Dataset deleted. {}".format(response.result()))