跳到主要内容

using_database()

Addedv2.5.x

This operation changes the database currently in use.

📘Notes

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

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

    • Free & Serverless

      https://{cluster-id}.serverless.{region}.cloud.zilliz.com.cn

    • Dedicated

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

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

    https://{project-id}.{region}.api.cloud.zilliz.com.cn

Request Syntax

using_database(
db_name: str,
**kwargs,
)

PARAMETERS:

  • db_name (string) -

    [REQUIRED]

    Name of the database to use.

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.using_database("my_db")