delete_dataset

DatasetsApi.delete_dataset(id, role_id, force_delete=None, delete_lineage=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)

Delete the dataset

Deletes a dataset. The caller must be the dataset owner. Deletion behaviour depends on the dataset type and registration status - View datasets (DatasetType = view) — deletion is always asynchronous. A Lambda is invoked to drop the view and the response returns immediately with “Dataset deletion triggered.” - Non-view datasets with RegistrationStatus = pending — deletion is synchronous. DynamoDB metadata and related artifacts are removed directly and the response returns “Dataset deletion successful”. - Non-view datasets with RegistrationStatus = completed or delete-failed — deletion is asynchronous. A Step Function is triggered to clean up S3 files, Redshift/Glue tables, DynamoDB metadata, and other resources. The response returns immediately with “Dataset deletion triggered.” Force delete — applicable only to Redshift datasets. When a Redshift dataset’s only dependencies are Redshift views, passing force_delete=true bypasses those view dependencies and proceeds with deletion. Using force_delete on a non-Redshift dataset returns an error. Dependent resources — if the dataset has dependent resources (jobs, pipelines, views, datalabs, dashboards, etc.), the API returns HTTP 400 with a DependentResources array listing each dependency category and its entries. Resolve or remove these dependencies before retrying.

Parameters:
  • id (str) – Unique identifier (DatasetId) of the dataset to delete. (required)

  • role_id (str) – IAM role identifier for the calling user. (required)

  • force_delete (str) – Set to “true” to force-delete a Redshift dataset that has Redshift-only view dependencies. Returns error DS-1087 if set on a non-Redshift dataset. Case-insensitive.

  • delete_lineage (str) – Set to “true” to also delete associated lineage metadata during the deletion process. Defaults to “false”.

  • _request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.

  • _request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.

  • _content_type (str, Optional) – force content-type for the request.

  • _headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.

  • _host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.

Return type:

DeleteDatasetResponse

Returns:

Returns the result object.

Request and Response Examples

HTTP: DELETE /datasets/{id}

Success (HTTP 200)

Dataset deleted (sync) or deletion triggered (async). Check the Message field to determine which path was taken.

Errors

Documented error codes: DS-1008, GE-1029, DS-1007, DS-1087, IPV-1002.

HTTP 400

Validation error or dependent resources exist. When dependent resources block deletion, the response includes a DependentResources array and an actionable Message.

Dataset has dependent resources

{
  "Message": "Dataset has dependent resources, resolve the dependencies to delete the dataset",
  "DependentResources": [
    {
      "ResourceType": "Views",
      "Resources": [
        {
          "ViewName": "my_view",
          "ViewId": "vw-12345"
        }
      ]
    }
  ]
}

Redshift-only view dependencies (force_delete available)

{
  "Message": "Dataset has dependent resources in Redshift, resolve the dependencies or force delete the dataset",
  "DependentResources": [
    {
      "ResourceType": "Views",
      "Resources": [
        {
          "ViewName": "rs_view",
          "ViewType": "redshift"
        }
      ]
    }
  ]
}

Caller is not the dataset owner

{
  "Message": "DS-1008 - User not authorized to delete the dataset - ds-abc123"
}

Dataset is already inactive

{
  "Message": "GE-1029 - Dataset is already deleted."
}

Dataset is in a non-deletable state

{
  "Message": "DS-1007 - Dataset can not be deleted while in extracting-schema state."
}

force_delete used on a non-Redshift dataset

{
  "Message": "DS-1087 - Failed to delete dataset due to error - Force delete only supported for redshift datasets"
}

DatasetId does not exist

{
  "Message": "IPV-1002 - Invalid DatasetId - ds-abc123, resource not found."
}

HTTP 500

Internal server error during deletion