ElasticMapper
ElasticSearch mapper for three ORMs - SQLAlchemy, Peewee, DjangoORM.
Allows you to easily generate ElasticSearch mappings based on models.
Installation
pip install elasticmapper
Basic usage
Peewee example
from peewee import *
from elasticmapper import PeeweeMapper
db = SqliteDatabase('my_app.db')
class BaseModel(Model):
class Meta:
database = db
class User(BaseModel):
username = CharField(unique=True)
is_active = BooleanField(default=True)
age = IntegerField()
user_elastic_mapping = PeeweeMapper(model=User).load()
SQLAlchemy example
from sqlalchemy.orm import declarative_base
from sqlalchemy import Column, Integer, String, Boolean
from elasticmapper import SQLAlchemyMapper
Base = declarative_base()
class User(Base):
__tablename__ = 'users'
id = Column(Integer, primary_key=True)
username = Column(String)
is_active = Column(Boolean)
age = Column(Integer)
user_elastic_mapping = SQLAlchemyMapper(model=User).load()
DjangoORM example
from django.db import models
from elasticmapper import DjangoMapper
class User(models.Model):
username = models.CharField(max_length=30)
is_active = models.BooleanField(default=True)
age = models.IntegerField()
user_elastic_mapping = DjangoMapper(model=User).load()
Output for all examples:
{
'id': {'type': 'integer'},
'username': {'type': 'text'},
'age': {'type': 'integer'},
'is_active': {'type': 'boolean'}
}
Documentation
Documentation lives here.
Contributing
PR are welcome! If you want to help, please check the issues and fix one of them. Thank you for your contribution.
License
Copyright © 2022 Polina Beskorovaynaya ihatemilk
This project has MIT License.
Metadata
Release files for elasticmapper 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| elasticmapper-1.0.0.tar.gz | 5.8 kB | Without provenance | Details for elasticmapper-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| elasticmapper-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for elasticmapper-1.0.0-py3-none-any.whl |
Total release size: 12.7 kB
Release files / elasticmapper-1.0.0.tar.gz
| Download URL | elasticmapper-1.0.0.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bbe2290c3b6f7b4c29b10bb9a7fd1eae64d5c183d618f70c2c4ce8117ff92caa
|
|
BLAKE2b-256 checksum How to use checksums |
82debbb68acbd6b1eaa900f1d7c3b8efbba1b082a6ff3cb6bc3562287adcf365
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.14
|
Release files / elasticmapper-1.0.0-py3-none-any.whl
| Download URL | elasticmapper-1.0.0-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2de004075e5cc162606846645cb19e13b39f6c8ea9e7d1c4d2514fa68277c919
|
|
BLAKE2b-256 checksum How to use checksums |
d0c3d41ac1b15e5671323b25519951adf15a31511278b511eadd4cf963b6db1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.14
|
Security for elasticmapper 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.