Delete a partition

更新时间: 2026-03-11 07:20:35

Delete a partition from a DashVector collection using the Python SDK.

Warning

Deleting a partition is irreversible. All data in the partition is permanently deleted.

Prerequisites

Before you begin, make sure that you have:

API signature

Collection.delete_partition(name: str) -> DashVectorResponse

Request parameters

ParameterTypeRequiredDescription
namestrYesName of the partition to delete.

Response parameters

The method returns a DashVectorResponse object with the following fields:

ParameterTypeDescriptionExample
codeintStatus code. For more information, see Status codes.0
messagestrResponse message.success
request_idstrUnique request ID.19215409-ea66-4db9-8764-26ce2eb5bb99

Example

Replace the following placeholders with your actual values:

PlaceholderDescription
YOUR_API_KEYAPI key for your DashVector cluster
YOUR_CLUSTER_ENDPOINTEndpoint of your DashVector cluster
YOUR_COLLECTION_NAMEName of the target collection
import dashvector

client = dashvector.Client(
    api_key='YOUR_API_KEY',
    endpoint='YOUR_CLUSTER_ENDPOINT'
)

collection = client.get(name='YOUR_COLLECTION_NAME')

# Delete the partition named "shoes"
resp = collection.delete_partition('shoes')

# Check the result
if resp:
    print('delete_partition success')
else:
    print(f'delete_partition failed: {resp.message}')
上一篇: Get partition statistics 下一篇: SDK for Java