Skip to main content

Pydastic is an elasticsearch python ORM based on Pydantic.

Project description

Pydastic

Package version

build Python Version Dependencies Status Code style: black

Security: bandit Pre-commit Semantic Versions License Coverage Report

Pydastic is an elasticsearch python ORM based on Pydantic.

💾 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

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)

Uploaded Source

Built Distribution

pydastic-0.2.2-py3-none-any.whl (6.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page