delete_dataset_files

DatasetsApi.delete_dataset_files(id, role_id, file_add_delete, action=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)

Manage dataset files (delete, restore, tag, archive restore)

Performs bulk file operations. Operation values include delete, restore, permanent_delete, restore_from_archive, grant, revoke, update_tags. Caller must be owner or editor. Iceberg/Hudi/DeltaLake and many external targets block these ops (GE-1106 / DS-*). For grant/revoke set query action=tag_files. TruncateDataset is only valid with permanent_delete. Some ops are async (SF); Message indicates the accepted action.

Parameters:
  • id (str) – Dataset ID containing the files. (required)

  • role_id (str) – Amorphic role ID. Caller must be owner or editor. (required)

  • file_add_delete (FileAddDelete) – (required)

  • action (str) – Use tag_files for grant/revoke TBAC file-tag operations.

  • _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:

ManageDatasetFilesResponse

Returns:

Returns the result object.

Request and Response Examples

HTTP: PUT /datasets/{id}/files

Request

Request / response example

{
  "Operation": "delete",
  "Files": [
    "data/old_file1.csv",
    "data/old_file2.csv"
  ]
}

Success (HTTP 200)

File operation accepted or completed. Message varies by Operation.

deleteTriggered

{
  "Message": "Delete File(s) operation triggered."
}

restoreTriggered

{
  "Message": "Restore File(s) operation triggered."
}

Errors

Documented error codes: AUTH-1010, DS-1038, DS-1039, GE-1106, DS-1040, GE-1034, DS-1002.

HTTP 400

Validation/auth failure. Codes include AUTH-1010, DS-1038 (invalid Operation), DS-1039 (TruncateDataset misuse), GE-1106 (unsupported dataset type), DS-1040/1073 and related file/lifecycle codes. GE-1034 is returned when the dataset is busy: either its DatasetStatus is not `active` (a reload, framework data load or an earlier truncate still holds it) or one or more files are still processing. Both are transient - retry once the current operation completes. The busy-dataset case previously returned DS-1002 (“Inactive DatasetId”) as a 500.

Invalid Operation

{
  "Message": "DS-1038 - Invalid Operation value"
}

Unsupported dataset type

{
  "Message": "GE-1106 - Operation not supported for this dataset type"
}

HTTP 500

Backend/generic failure.