About PyMilvus
PyMilvus is a Python SDK of Milvus. Its source code is open-sourced and hosted on GitHub.
In this release, you have the flexibility to choose MilvusClient or the original ORM module to talk with Milvus.
Compatibility
Milvus version | Recommended PyMilvus version |
---|---|
1.0.x | 1.0.1 |
1.1.x | 1.1.2 |
2.0.x | 2.0.2 |
2.1.x | 2.1.3 |
2.2.x | 2.2.3 |
2.3.x | 2.3.7 |
2.4.x | 2.4.4 |
Install & Update
You can run the following command to install the latest PyMilvus or update your PyMilvus to this version.
pip install --upgrade pymilvus==v2.4.4
After the installation, you can check the PyMilvus version by running the following
from pymilvus import __version__
print(__version__)
# v2.4.4
To install the Model library for embedding operations, run the following command:
pip install pymilvus[model]
For details, refer to the Model library documents and examples.
Connect to Milvus
from pymilvus import MilvusClient
# Authentication not enabled
client = MilvusClient("http://localhost:19530")
# Authentication enabled with the root user
client = MilvusClient(
uri="http://localhost:19530",
token="root:Milvus",
db_name="default"
)
# Authentication enabled with a non-root user
client = MilvusClient(
uri="http://localhost:19530",
token="user:password", # replace this with your token
db_name="default"
)
What’s New
In this version, PyMilvus adds a MilvusClient module that incorporates several functional methods, aligning its functionality overall with that of the legacy ORM module.
Collection-related methods
- create_collection()
- rename_collection()
- describe_collection()
- has_collection()
- list_collections()
- drop_collection()
- get_collection_stats()
- load_collection()
- release_collection()
- get_load_state()
- refresh_load()
Data-related methods
Alias-related methods
Partition-related methods
- create_partition()
- drop_partition()
- has_partition()
- list_partitions()
- load_partitions()
- release_partitions()
- get_partition_stats()
Index-related methods
User- and RBAC-related methods
- create_user()
- drop_user()
- update_password()
- list_users()
- describe_user()
- grant_role()
- revoke_role()
- create_role()
- drop_role()
- describe_role()
- list_roles()
- grant_privilege()
- revoke_privileges()
Examples
In addition to the documents, you can also refer to the example sets in our GitHub repo.
Feedback & Issues
If you are having trouble or have questions about PyMilvus, ask your question on our PyMilvus Community Forum. Once you get an answer, it’d be great if you could work it back into this documentation and contribute!
Contributing
We are committed to building a collaborative, exuberant open-source community for PyMilvus. Therefore, contributions to PyMilvus are welcome from everyone. Refer to Contributing Guideline before making contributions to this project. You can file an issue or contact us on Slack if you need any assistance or want to propose your ideas about PyMilvus.