All Projects → Scille → Umongo

Scille / Umongo

Licence: mit
sync/async MongoDB ODM, yes.

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects

Projects that are alternatives of or similar to Umongo

Odmantic
Async ODM (Object Document Mapper) for MongoDB based on python type hints
Stars: ✭ 240 (-27.49%)
Mutual labels:  asyncio, odm, mongodb
Php Mongo
MongoDB ODM. Part of @PHPMongoKit
Stars: ✭ 228 (-31.12%)
Mutual labels:  odm, mongodb
Mongolid Laravel
Easy, powerful and ultrafast MongoDB ODM for Laravel.
Stars: ✭ 222 (-32.93%)
Mutual labels:  odm, mongodb
Beanie
Micro ODM for MongoDB
Stars: ✭ 56 (-83.08%)
Mutual labels:  asyncio, mongodb
Qxorm
QxOrm library - C++ Qt ORM (Object Relational Mapping) and ODM (Object Document Mapper) library - Official repository
Stars: ✭ 176 (-46.83%)
Mutual labels:  odm, mongodb
Mongodm
A golang object document mapper (ODM) for MongoDB
Stars: ✭ 178 (-46.22%)
Mutual labels:  odm, mongodb
Eliot
Eliot: the logging system that tells you *why* it happened
Stars: ✭ 874 (+164.05%)
Mutual labels:  asyncio, twisted
Typegoose
Typegoose - Define Mongoose models using TypeScript classes.
Stars: ✭ 1,189 (+259.21%)
Mutual labels:  odm, mongodb
Arsenic
Async WebDriver implementation for asyncio and asyncio-compatible frameworks
Stars: ✭ 209 (-36.86%)
Mutual labels:  asyncio, twisted
Pyee
A port of Node.js's EventEmitter to python
Stars: ✭ 236 (-28.7%)
Mutual labels:  asyncio, twisted
Wither
An ODM for MongoDB built on the official MongoDB Rust driver.
Stars: ✭ 174 (-47.43%)
Mutual labels:  odm, mongodb
prometheus-async
Async helpers for prometheus_client.
Stars: ✭ 136 (-58.91%)
Mutual labels:  twisted, asyncio
Mongorito
🍹 MongoDB ODM for Node.js apps based on Redux
Stars: ✭ 1,409 (+325.68%)
Mutual labels:  odm, mongodb
Ts Mongoose
Automatically infer TypeScript interfaces from mongoose schemas🙀
Stars: ✭ 188 (-43.2%)
Mutual labels:  odm, mongodb
Typegoose
Typegoose - Define Mongoose models using TypeScript classes.
Stars: ✭ 1,232 (+272.21%)
Mutual labels:  odm, mongodb
Requests Threads
🎭 Twisted Deferred Thread backend for Requests.
Stars: ✭ 366 (+10.57%)
Mutual labels:  asyncio, twisted
Phalcon Mongodb Odm
MongoDB ODM for Phalcon framework for new mongodb php extension with query builder and rich functionality
Stars: ✭ 42 (-87.31%)
Mutual labels:  odm, mongodb
Mongo Thingy
🍃 The most idiomatic and friendly-yet-powerful way to use MongoDB with Python
Stars: ✭ 49 (-85.2%)
Mutual labels:  odm, mongodb
Fooproxy
稳健高效的评分制-针对性- IP代理池 + API服务,可以自己插入采集器进行代理IP的爬取,针对你的爬虫的一个或多个目标网站分别生成有效的IP代理数据库,支持MongoDB 4.0 使用 Python3.7(Scored IP proxy pool ,customise proxy data crawler can be added anytime)
Stars: ✭ 195 (-41.09%)
Mutual labels:  asyncio, mongodb
aioScrapy
基于asyncio与aiohttp的异步协程爬虫框架 欢迎Star
Stars: ✭ 34 (-89.73%)
Mutual labels:  twisted, asyncio

====================== μMongo: sync/async ODM

.. image:: https://img.shields.io/pypi/v/umongo.svg :target: https://pypi.python.org/pypi/umongo :alt: Latest version

.. image:: https://img.shields.io/pypi/pyversions/umongo.svg :target: https://pypi.org/project/umongo/ :alt: Python versions

.. image:: https://img.shields.io/badge/marshmallow-3-blue.svg :target: https://marshmallow.readthedocs.io/en/latest/upgrading.html :alt: marshmallow 3 only

.. image:: https://img.shields.io/pypi/l/umongo.svg :target: https://umongo.readthedocs.io/en/latest/license.html :alt: License

.. image:: https://dev.azure.com/lafrech/umongo/_apis/build/status/Scille.umongo?branchName=master :target: https://dev.azure.com/lafrech/umongo/_build/latest?definitionId=1&branchName=master :alt: Build status

.. image:: https://readthedocs.org/projects/umongo/badge/ :target: http://umongo.readthedocs.io/ :alt: Documentation

μMongo is a Python MongoDB ODM. It inception comes from two needs: the lack of async ODM and the difficulty to do document (un)serialization with existing ODMs.

From this point, μMongo made a few design choices:

  • Stay close to the standards MongoDB driver to keep the same API when possible: use find({"field": "value"}) like usual but retrieve your data nicely OO wrapped !
  • Work with multiple drivers (PyMongo_, TxMongo_, motor_asyncio_ and mongomock_ for the moment)
  • Tight integration with Marshmallow_ serialization library to easily dump and load your data with the outside world
  • i18n integration to localize validation error messages
  • Free software: MIT license
  • Test with 90%+ coverage ;-)

.. _PyMongo: https://api.mongodb.org/python/current/ .. _TxMongo: https://txmongo.readthedocs.org/en/latest/ .. _motor_asyncio: https://motor.readthedocs.org/en/stable/ .. _mongomock: https://github.com/vmalloc/mongomock .. _Marshmallow: http://marshmallow.readthedocs.org

µMongo requires MongoDB 4.2+ and Python 3.7+.

Quick example

.. code-block:: python

import datetime as dt
from pymongo import MongoClient
from umongo import Document, fields, validate
from umongo.frameworks import PyMongoInstance

db = MongoClient().test
instance = PyMongoInstance(db)

@instance.register
class User(Document):
    email = fields.EmailField(required=True, unique=True)
    birthday = fields.DateTimeField(validate=validate.Range(min=dt.datetime(1900, 1, 1)))
    friends = fields.ListField(fields.ReferenceField("User"))

    class Meta:
        collection_name = "user"

# Make sure that unique indexes are created
User.ensure_indexes()

goku = User(email='[email protected]', birthday=dt.datetime(1984, 11, 20))
goku.commit()
vegeta = User(email='[email protected]', friends=[goku])
vegeta.commit()

vegeta.friends
# <object umongo.data_objects.List([<object umongo.dal.pymongo.PyMongoReference(document=User, pk=ObjectId('5717568613adf27be6363f78'))>])>
vegeta.dump()
# {id': '570ddb311d41c89cabceeddc', 'email': '[email protected]', friends': ['570ddb2a1d41c89cabceeddb']}
User.find_one({"email": '[email protected]'})
# <object Document __main__.User({'id': ObjectId('570ddb2a1d41c89cabceeddb'), 'friends': <object umongo.data_objects.List([])>,
#                                 'email': '[email protected]', 'birthday': datetime.datetime(1984, 11, 20, 0, 0)})>

Get it now::

$ pip install umongo           # This installs umongo with pymongo
$ pip install my-mongo-driver  # Other MongoDB drivers must be installed manually

Or to get it along with the MongoDB driver you're planing to use::

$ pip install umongo[motor]
$ pip install umongo[txmongo]
$ pip install umongo[mongomock]
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].