All Products
Search
Document Center

Object Storage Service:Delete a vector bucket (Python SDK V2)

Last Updated:Jun 03, 2026

You can use the Python SDK V2 to call the DeleteVectorBucket operation to delete a vector bucket. This operation is irreversible. Proceed with caution.

Permissions

An Alibaba Cloud account has full permissions by default. RAM users and roles have no permissions by default and must be granted permissions through a RAM policy overview or a bucket policy.

API

Action

Description

DeleteVectorBucket

oss:DeleteVectorBucket

Deletes a vector bucket.

Method definition

delete_vector_bucket(request: DeleteVectorBucketRequest, **kwargs) → DeleteVectorBucketResult[source]¶

Request parameters

Parameter

Type

Description

request

DeleteVectorBucketRequest

Set the request parameters. For more information, see DeleteVectorBucketRequest.

Return values

Type

Description

DeleteVectorBucketResult

The return value. For more information, see DeleteVectorBucketResult.

For the complete definition of the delete_vector_bucket method, see delete_vector_bucket.

Examples

import argparse
import alibabacloud_oss_v2 as oss
import alibabacloud_oss_v2.vectors as oss_vectors

parser = argparse.ArgumentParser(description="vector delete bucket sample")
parser.add_argument('--region', help='The region of the bucket.', required=True)
parser.add_argument('--bucket', help='The name of the bucket.', required=True)
parser.add_argument('--endpoint', help='The OSS access endpoint.')
parser.add_argument('--account_id', help='The ID of your Alibaba Cloud account.', required=True)

def main():
    args = parser.parse_args()

    # Load credentials from environment variables
    credentials_provider = oss.credentials.EnvironmentVariableCredentialsProvider()

    # Use the SDK's default configuration
    cfg = oss.config.load_default()
    cfg.credentials_provider = credentials_provider
    cfg.region = args.region
    cfg.account_id = args.account_id
    cfg.use_internal_endpoint = True  # To access OSS over the public network, set this to False or delete this line.

    if args.endpoint is not None:
        cfg.endpoint = args.endpoint

    vector_client = oss_vectors.Client(cfg)

    result = vector_client.delete_vector_bucket(oss_vectors.models.DeleteVectorBucketRequest(
        bucket=args.bucket,
    ))

    print(f'status code: {result.status_code},'
          f' request id: {result.request_id},'
    )

if __name__ == "__main__":
    main()

References

For the complete sample code for deleting a vector bucket, see delete_vector_bucket.py