跳到主要内容

has_connection()

Near Deprecation

此操作检查是否已建立具有给定别名的连接。

请求语法​

python
has_connection(alias: str)

参数:

  • alias (string) -

    [必填]

    连接别名。

返回类型:

Boolean

返回:

一个 Boolean 值,指示该连接是否存在。

Notes

已存在的连接别名并不一定表示相应的连接已经建立。

仅当连接别名存在且相应的连接已建立时,此操作才会返回 True。

异常:

  • ConnectionConfigException

    当连接配置无效时,将引发此异常。

示例​

python
from pymilvus import connections

connections.has_connection(alias="default")

# Output
# True

以下操作与 has_connection() 相关:

最低 SDK 版本Inherit