SQLModel-like library for Milvus
Project description
PyMilvusModel
Inspired by SQLModel, PyMilvusModel:
is a library for interacting with Milvus databases from Python code, with Python objects.
and follows the same paradigm, using Python type annotations and powered by Pydantic
Installation
pip install milvusmodel.py
Example Usage
from typing import List, Optional
from typing_extensions import Annotated
from pymilvus import MilvusClient, DataType
from pymilvusmodel import MilvusIndexParam, MilvusField, MilvusModel
class ExampleModel(MilvusModel):
indexes: list[MilvusIndexParam] = [
MilvusIndexParam("vector", "IVF_FLAT", "vector_index", metric_type="COSINE", params={
"nlist": 128
})
]
id: Annotated[
Optional[int],
MilvusField(name="id", dtype=DataType.INT64,
is_primary=True, auto_id=True)
] = None
vector: Annotated[
List[float],
MilvusField(name="vector", dtype=DataType.FLOAT_VECTOR, dim=2)
]
MILVUS_CLIENT = MilvusClient("http://localhost:19530")
MilvusModel.metadata.create_all(MILVUS_CLIENT)
print(MILVUS_CLIENT.list_collections()) # ['ExampleModel']
ExampleModel.insert(ExampleModel(vector=[0, 1]))
print(ExampleModel.query(filter="id>=0")) # [ExampleModel(indexes=[<pymilvusmodel.index.MilvusIndexParam object at 0x105c825d0>], id=456328785400861845, vector=[0.0, 1.0])]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file milvusmodel_py-0.2.0b0.tar.gz.
File metadata
- Download URL: milvusmodel_py-0.2.0b0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c546eaeb4946be2e2f98b94c5a4f8c69d0988e5929c4f0c0d1686c704fbb0dfa
|
|
| MD5 |
0f95e235cf87868e0cd67923b15437da
|
|
| BLAKE2b-256 |
59001e9d7e4f5d134215469f6c5ac8e4510560915b9b277f4ca0feb6758a9085
|
Provenance
The following attestation bundles were made for milvusmodel_py-0.2.0b0.tar.gz:
Publisher:
python-publish.yml on brianferri/PyMilvusModel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
milvusmodel_py-0.2.0b0.tar.gz -
Subject digest:
c546eaeb4946be2e2f98b94c5a4f8c69d0988e5929c4f0c0d1686c704fbb0dfa - Sigstore transparency entry: 923508927
- Sigstore integration time:
-
Permalink:
brianferri/PyMilvusModel@2eb19b440f2975fc96dd0e88e22388632a656915 -
Branch / Tag:
refs/tags/0.2.0-beta - Owner: https://github.com/brianferri
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@2eb19b440f2975fc96dd0e88e22388632a656915 -
Trigger Event:
release
-
Statement type:
File details
Details for the file milvusmodel_py-0.2.0b0-py3-none-any.whl.
File metadata
- Download URL: milvusmodel_py-0.2.0b0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52f698a5c52f2344d2d9e8bf894bbd3669356380d0acc94a88bdaeeb056a1f37
|
|
| MD5 |
d2e566f760c3a5534fc1d014c379db15
|
|
| BLAKE2b-256 |
61c150d48d8d3c76f03bf3aec6dc3c754dde6c78c74d3c49250930474916d445
|
Provenance
The following attestation bundles were made for milvusmodel_py-0.2.0b0-py3-none-any.whl:
Publisher:
python-publish.yml on brianferri/PyMilvusModel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
milvusmodel_py-0.2.0b0-py3-none-any.whl -
Subject digest:
52f698a5c52f2344d2d9e8bf894bbd3669356380d0acc94a88bdaeeb056a1f37 - Sigstore transparency entry: 923508980
- Sigstore integration time:
-
Permalink:
brianferri/PyMilvusModel@2eb19b440f2975fc96dd0e88e22388632a656915 -
Branch / Tag:
refs/tags/0.2.0-beta - Owner: https://github.com/brianferri
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@2eb19b440f2975fc96dd0e88e22388632a656915 -
Trigger Event:
release
-
Statement type: