ognom
Documentation: #TODO
Ognom is object-to-document mapper for mongodb. Currently ognom uses pymongo as default backend, but you can easily implement your own backend based on another driver (for example asyncio-mongo) if needed, as serialization and storage logic in ognom are separated.
Supports python2.7+, python3.3+, PyPy.
Documentation: #TODO
Install
pip install ognom
Tests
tox
Features
Vanilla python, no dependencies;
From version 1.0 exposes full pymongo API(!);
Easy to write your own backend with your own API.
Quickstart
from ognom.base import ConnectionManager, Document, Collection
from ognom.fields import StringField, IntField
ConnectionManager.connect({
'main': { # ognom use aliases for databases to make it possible to use multiple db's per project
'name': 'birzha_main',
'args': ['127.0.0.1:27017'],
'kwargs': {'socketTimeoutMS': 60000}},})
class Foo(Document):
objects = Collection(
db_name='main'
collection_name='my_foos' # collection name (by default 'foos')
indexes=[{
'index': [('bar', 1), ('baz', -1)],
'background': True}])
bar = StringField(required=True, default='baaar')
baz = IntField(choices=[10, 20, 30, 40, 50])
foo1 = Foo.objects.create({'bar': 'lalala'})
assert Foo.objects.get({'bar': 'lalala'}).id == foo1.id
foo2 = Foo(bar='lololo', baz=10)
assert foo2.id is None
foo2.save()
assert foo2.id is not None
foo2.remove()
foos = Foo.objects.find({'bar': 'lalala'}) # not list but CursorWrapper!
assert len(list(foos)) == 1
Contributors
Lev Orekhov @lorehov
Michael Elovskikh @wronglink
Sardnej @sardnej
Metadata
Release files for ognom 0.5.4
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 |
|---|---|---|---|---|
| ognom-0.5.4.tar.gz | 16.2 kB | Without provenance | Details for ognom-0.5.4.tar.gz |
Release files / ognom-0.5.4.tar.gz
| Download URL | ognom-0.5.4.tar.gz |
|---|---|
| Size | 16.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f6191a1355e5da53514b278f5e9281639792d8d00de0e05dd0f9d11ba0381eed
|
|
BLAKE2b-256 checksum How to use checksums |
800e864702bd6ff08fccfc96099b7a2e65543b14eabddef820ede902cd408afe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for ognom 0.5.4
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.