Skip to main content

Schema-less Pythonic Mongo ORM

Project description

mongo_pickle

Schema-less Pythonic Mongo ORM.

Designed to allow quick prototyping when developing and designing systems.

Exposes an interface to store and query generic python objects from and to Mongo databases without the need to declare schemas when creating an initial DAL.

Usage:

Assuming you have some business logic that creates event data:

from mongo_pickle.collection import CollectionConfig
from mongo_pickle.model import Model

from datetime import datetime

class EventsConfig(CollectionConfig):
    host = 'sample.mlab.com'
    port = 27017

    database = 'database_name'
    collection = "events_v1"
    username = ''
    password = ''


class Event(Model):
    COLLECTION = EventsConfig.get_collection() # Shortcut to get pymongo collection

    def __init__(self, title, description, event_time):
        super(Event, self).__init__()
        self.title = title
        self.description = description
        self.event_time = event_time


if __name___ == '__main__':
    python_event = Event('cool event', 'code generated output', datetime.now())

    # Stored to your collection
    python_event.save()

    # Retrieve data
    all_events = Event.load_objects()

    # Supports mongo query filters
    all_events = Event.load_objects({'title': 'cool_event')

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

mongo_pickle-0.1.6.zip (9.9 kB view details)

Uploaded Source

File details

Details for the file mongo_pickle-0.1.6.zip.

File metadata

  • Download URL: mongo_pickle-0.1.6.zip
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.6.2

File hashes

Hashes for mongo_pickle-0.1.6.zip
Algorithm Hash digest
SHA256 08d771023ddf11b026ccc5d0896587bcc3a0529ad6a0a6c04e6fd4f43e4c6cfe
MD5 b31213070067a658e2962b18a426780a
BLAKE2b-256 b8d35f6c1ddcacc0a9cc744b046f921179fd6b1f8b52311ff6b32d3511f1de59

See more details on using hashes here.

Supported by

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