This guide shows how to rename a collection and update collection-level properties after creation.
Using vbase.raw
Some collection modification APIs are exposed through the underlying Milvus-compatible client. In the DODIL SDK, you can access it via:
raw = vbase.rawYou’ll use raw in the examples below.
Rename a collection
Renaming changes the collection’s name (metadata) without moving your data.
# Rename an existing collection
vbase.raw.rename_collection(
old_name="my_collection",
new_name="my_new_collection",
)Notes
- If you have application code that references the old name, update it accordingly.
- If you need a stable name while changing the underlying collection, consider using aliases (see the Aliases guide).
Set collection properties
You can modify certain collection-level properties after a collection is created.
Supported properties
Below are common properties you can update (availability may vary by backend/version):
| Property | What it does |
|---|---|
collection.ttl.seconds | Time-to-live (TTL) in seconds. After TTL expires, entities are deleted asynchronously. |
mmap.enabled | Enables memory mapping (mmap) so indexes/data can be stored across RAM + disk for larger capacity. |
partitionkey.isolation | Enables Partition Key Isolation: creates separate indexes per partition-key value to reduce scan scope. |
dynamicfield.enabled | Enables dynamic fields (if the collection was created without it). Allows inserting extra fields not defined in schema. |
allow_insert_auto_id | Controls whether user-provided primary keys are accepted when AutoID is enabled. |
timezone | Default timezone for time-sensitive operations (e.g., TIMESTAMPTZ). Must be a valid IANA timezone (e.g., UTC, Africa/Cairo). |
Example 1: Set collection TTL
# Delete entities after 7 days (7 * 24 * 60 * 60 seconds)
seconds_7_days = 7 * 24 * 60 * 60
vbase.raw.alter_collection_properties(
collection_name="my_collection",
properties={
"collection.ttl.seconds": str(seconds_7_days),
},
)What to expect: TTL deletion is asynchronous—data may still be searchable for a short period until cleanup completes.
Example 2: Enable mmap
vbase.raw.alter_collection_properties(
collection_name="my_collection",
properties={
"mmap.enabled": "true",
},
)Example 3: Enable Partition Key Isolation
vbase.raw.alter_collection_properties(
collection_name="my_collection",
properties={
"partitionkey.isolation": "true",
},
)Example 4: Enable dynamic fields
If your collection was created without dynamic fields, you can enable them later:
vbase.raw.alter_collection_properties(
collection_name="my_collection",
properties={
"dynamicfield.enabled": "true",
},
)Once enabled, you can insert entities that contain additional fields beyond the original schema (those fields will be stored under the dynamic field).
Example 5: Allow user-provided primary keys when AutoID is enabled
By default, AutoID collections generate primary keys. If you want to allow user-provided primary keys when they are present:
vbase.raw.alter_collection_properties(
collection_name="my_collection",
properties={
"allow_insert_auto_id": "true",
},
)Example 6: Set collection timezone
Useful when you rely on time-aware fields (like TIMESTAMPTZ) and want consistent display/comparison behavior.
vbase.raw.alter_collection_properties(
collection_name="my_collection",
properties={
"timezone": "Africa/Cairo",
},
)Verify your changes
You can confirm settings using describe_collection:
info = vbase.describe_collection("my_collection")
print(info)If a property isn’t shown, it may be unsupported by your backend/version, or the backend may surface it via a different field.
Troubleshooting
I can’t find alter_collection_properties / rename_collection
- Ensure you are calling them via
vbase.raw. - If your backend restricts admin operations, verify your service account permissions.
I’m connected through a proxy
If you connect through a VBase endpoint (HTTPS + token-based auth), some cluster-level operations may be restricted. Collection-level operations shown above are typically supported, but exact behavior depends on your deployment.