Skip to main content

Mongo ORM

Project description

https://badge.fury.io/py/snakelet.svg

Snakelet is a Schema-less ORM-like system built in pure Python to reduce redundancy with Mongo Native Drivers and Object Management. This package contains a very simple implementation and will need to be expanded upon largely to remain relevant.

documents

Registration only requires exposing the object to the Manager.

from snakelet.storage import Document, Manager

class Cat(Document):
    pass

manager = Manager(database='felines')
manager.register(Cat)

managers

Connecting to a database is fairly straightforward.

from snakelet.storage import Manager

manager = Manager(
    database='felines',
    host='localhost',
    port=27017,
    username='admin',
    password='pass'
)

By default, Managers build and fetch collections in snake case, but this can be switched to camel case during instantiation.

from snakelet.storage import Manager

manager = Manager(
    case='camel'
)

Finding, Saving, and Removal are also pretty straightforward.

pye = manager.Cat.find_one({'name': 'pyewacket'})
shoshana = Cat()
shoshana['name'] = 'shoshana'
shoshana['owner'] = 'schrodinger'
manager.save(shoshana)
schrodinger = manager.Cat.find({'owner': 'schrodinger'})
manager.remove(pye)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
snakelet-0.5.0.tar.gz (7.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page