Skip to main content

create_database()

Addedv2.5.x

This operation creates a database.

📘Notes

This method applies only to dedicated serving clusters and on-demand compute.

  • For a database in dedicated serving clusters, please create MilvusClient with the cluster endpoint.

  • Free & Serverless

https://{cluster-id}.serverless.{region}.vectordb.zillizcloud.com

  • Dedicated

https://{cluster-id}.{region}.vectordb.zillizcloud.com:19530

  • For a database for on-demand compute, create MilvusClient with the project endpoints.

https://{project-id}.{region}.api.zillizcloud.com

Request Syntax

create_database(
db_name: str,
properties: Optional[dict] = None,
timeout: Optional[float] = None,
**kwargs,
)

PARAMETERS:

  • db_name (string) -

    [REQUIRED]

    Name of the database to create.

  • properties (dict | None) -

    📘This does not apply to database for on-demand compute.

    Properties of the database to be created. Possible database properties are as follows:

    • database.replica.number (int) -

      Number of replicas for the database.

    • database.resource_groups ([]str) -

      Resource groups dedicated to the database.

    • database.diskQuota.mb (int) -

      Disk quota allocated to the database in megabytes (MB).

    • database.max.collections (int) -

      Maximum number of collections allowed in the database.

    • database.force.deny.writing (bool) -

      Whether to deny all write operations in the database.

    • database.force.deny.reading (bool) -

      Whether to deny all read operations in the database.

  • timeout (float | None) -

    The timeout duration for this operation. Setting this to None indicates that it timeouts when a response arrives or an error occurs.

RETURN TYPE:

NoneType

RETURNS:

None

EXCEPTIONS:

  • MilvusException - Raised if any error occurs during this operation.

Examples

from pymilvus import MilvusClient

client = MilvusClient(uri, token) # db = "default"

client.create_database(
db_name="my_db"
)