Pydastic is an elasticsearch python ORM based on Pydantic.
Project description
💾 Installation
Pip:
pip install pydastic
Poetry:
poetry add pydastic
🚀 Features
- Simple CRUD operations supported
📋 Usage
Defining Models
class User(ESModel):
name: str
phone: Optional[str]
last_login: datetime = Field(default_factory=datetime.now)
class Meta:
index = "user"
CRUD: Create, Update
es = Elasticsearch(hosts="localhost:9200")
# Create and save doc
user = User(name="John", age=20)
user.save(es, wait_for=True)
assert user.id != None
# Update doc
user.name = "Sam"
user.save(es, wait_for=True)
Get Document
got = User.get(es, id=user.id)
assert got == user
CRUD: Delete
Not yet implemented.
📈 Releases
None yet.
You can see the list of available releases on the GitHub Releases page.
We follow Semantic Versions specification.
We use Release Drafter
. As pull requests are merged, a draft release is kept up-to-date listing the changes, ready to publish when you’re ready. With the categories option, you can categorize pull requests in release notes using labels.
🛡 License
This project is licensed under the terms of the MIT
license. See LICENSE for more details.
📃 Citation
@misc{pydastic,
author = {Rami Awar},
title = {Pydastic is an elasticsearch python ORM based on Pydantic.},
year = {2022},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/ramiawar/pydastic}}
}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pydastic-0.2.2.tar.gz
(7.0 kB
view hashes)