Python Persistence/ORM Module

205 views
Skip to first unread message

Christopher Coté

unread,
Feb 13, 2012, 7:57:48 PM2/13/12
to mongodb-user
I'm writing to let people know I've released a shiny new persistence
framework for Python and MongoDB.

It's called Humongolus. https://github.com/entone/Humongolus

Please feel free to try it out, I think you'll really like the
implementation. It's easy to use and stays out of the way when you
need it to.

I've used it on several large projects.

There's a pretty basic usage example in the readme, that should get
you started.

Also, 100% test coverage!

Bernie Hackett

unread,
Feb 13, 2012, 8:13:08 PM2/13/12
to mongod...@googlegroups.com
Cool! I'll add it to the tools section of the PyMongo docs.

http://api.mongodb.org/python/current/tools.html

> --
> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
>

Davi Vidal

unread,
Feb 13, 2012, 8:18:07 PM2/13/12
to mongod...@googlegroups.com, Christopher Coté

Hey! I'm just starting with Python/Django like NOW, coming from
Ruby on Rails/mongoid.

Sorry if it's a dumb question. Is it possible to use your 'driver'
with Django? How?


Thanks,

davi

Christopher Coté

unread,
Feb 13, 2012, 8:35:08 PM2/13/12
to Davi Vidal, mongod...@googlegroups.com

It is similar to the django model system, and i know there's some people working on a nosql version of django, but i have not tested it. If i have some time i would love to try to get it working.

Short answer. No.

On Feb 13, 2012 7:18 PM, "Davi Vidal" <davi...@gmail.com> wrote:

Christopher Coté

unread,
Feb 13, 2012, 8:35:08 PM2/13/12
to Davi Vidal, mongod...@googlegroups.com

I currently use it with a custom tornado/mako system

On Feb 13, 2012 7:18 PM, "Davi Vidal" <davi...@gmail.com> wrote:

Bernie Hackett

unread,
Feb 13, 2012, 8:46:04 PM2/13/12
to mongod...@googlegroups.com
You might want to check out django-mongodb-engine:

http://django-mongodb.org/

Please note it requires django-nonrel, not mainline django.

http://www.allbuttonspressed.com/projects/django-nonrel

MongoEngine also includes some tools for working with django:

http://mongoengine.org/docs/v0.5/django.html

On Mon, Feb 13, 2012 at 5:18 PM, Davi Vidal <davi...@gmail.com> wrote:

Andreas Jung

unread,
Feb 14, 2012, 12:14:38 AM2/14/12
to mongod...@googlegroups.com
Very cool work!

-aj

lists.vcf

Voltron

unread,
Feb 14, 2012, 7:43:04 AM2/14/12
to mongodb-user
Nice!

2 questions:

1. When would you have s simple widgets example/Tutorial up?
2. How is the speed compared to barebones Pymongo? Much overhead?


Thanks


On Feb 14, 1:57 am, Christopher Coté <ch...@entropealabs.com> wrote:
> I'm writing to let people know I've released a shiny new persistence
> framework for Python and MongoDB.
>
> It's called Humongolus.https://github.com/entone/Humongolus

Christopher Coté

unread,
Feb 14, 2012, 11:29:32 AM2/14/12
to mongodb-user
I'll be putting together some tutorials over the next week, hopefully
get a few up tonight on wiki.

I'll also get some benchmarks together.

Christopher Coté

unread,
Feb 14, 2012, 12:14:52 PM2/14/12
to mongodb-user
Some benchmarks.

The models:

class Job(orm.EmbeddedDocument):
title = field.Char()

class Human(orm.Document):
_db = "test"
_collection = "humans"
name = field.Char(required=True, min=2, max=25)
age = field.Integer(min=0, max=3000)
height = field.Float(min=1, max=100000)
weight = field.Float(min=1, max=30000)
jobs = orm.Relationship(type=Job)
genitalia = field.Char()

The dict:

human = {
"name":"Chris",
"age": 31,
"height":120,
"weight":180,
"jobs":[],
"genitalia":"outy"
}

100 inserts, safe=True

pymongo:
0.116407871246

humongolus:
0.271687984467

retrieving the data while printing the name

pymongo:
0.00512504577637

humongolus:
0.068286895752





On Feb 14, 6:43 am, Voltron <nhy...@googlemail.com> wrote:

Christopher Coté

unread,
Feb 14, 2012, 12:23:03 PM2/14/12
to mongodb-user
I added benchmark.py to the repo as well.

slothy

unread,
Feb 14, 2012, 12:27:38 PM2/14/12
to mongod...@googlegroups.com

I'm right now testing DRM?? (ORM) libs for python/mongo. Something i have not found is how to map or handle documents with diferent keys at orm level.

I'm testing you's right now

slothy
http://slothy_webcurriculum.
ep.io
http://qrcolors.ep.io

> 2. How i...

Christopher Coté

unread,
Feb 14, 2012, 5:50:14 PM2/14/12
to mongodb-user
different keys?

as in the field in the db is diffrerent then the field name in the
model?

this is actually pretty easy to implement, it's in another ORM i
built. i can think about adding it in.

It is definitely nice for getting around python reserved words.



On Feb 14, 11:27 am, slothy <slothyru...@gmail.com> wrote:
> I'm right now testing DRM?? (ORM) libs for python/mongo. Something i have
> not found is how to map or handle documents with diferent keys at orm level.
>
> I'm testing you's right now
>
> slothyhttp://slothy_webcurriculum.
> ep.iohttp://qrcolors.ep.io

Ross Lawley

unread,
Feb 15, 2012, 4:35:48 AM2/15/12
to mongod...@googlegroups.com
Congratulations Chris, I'm looking forward to playing with it.

田毅

unread,
Feb 15, 2012, 4:48:37 AM2/15/12
to mongod...@googlegroups.com
hi,all

 I set up a mongodb cluster with every mongod process started with "--keyFile" option.

mongos:                                         port 27017
mongod:    shard1  primary        port 27200
mongod:    shard1  secondary   port 27201
mongod:    shard2  primary        port 27202
mongod:    shard2  secondary   port 27203
config:                                             port 27019

then, I found I can't connect to mongod and get the serverStatus via java-driver.

my code is like this:

Mongo mongo = new Mongo("localhost", 27200);
DB testDB = mongo.getDB("test");
CommandResult resp = testDB.command("serverStatus");
System.out.println(resp);

the result is :

{ "serverUsed" : "localhost:27200" , "errmsg" : "need to login" , "ok" : 0.0}


but if I run 'mongo' in my console to connect to localhost:27200, I can get the serverStatus result.

Christopher Coté

unread,
Feb 15, 2012, 11:51:00 AM2/15/12
to mongodb-user
Please do, I would love any feedback.

Eliot Horowitz

unread,
Feb 16, 2012, 12:13:01 AM2/16/12
to mongod...@googlegroups.com

Christopher Coté

unread,
Feb 16, 2012, 11:19:42 AM2/16/12
to mongodb-user
A few updates,

Relationship is now called List.

I've added support for dbkey, meaning the key in mongo can differ from
that of your model attribute.

Basic html widgets.

All fields have dynamic validation now, meaning you can pass in your
own validation methods.

As far as tutorials, if you look through the tests directory as well
as test.py there are a lot of usage examples.

I'll be writing these up in more detail soon,

Voltron

unread,
Feb 16, 2012, 1:51:10 PM2/16/12
to mongodb-user
Great! Would there be a form widghet class soon? It would be great and
make it a complete alternative to WTForms

Christopher Coté

unread,
Feb 16, 2012, 9:11:01 PM2/16/12
to mongodb-user
Sounds like a good next step. I'll see what I can get into this
weekend ;)

Voltron

unread,
Feb 17, 2012, 3:06:38 AM2/17/12
to mongodb-user
May I suggest this fork of WTForms as study material?

https://github.com/lepture/tforms

Voltron

unread,
Feb 20, 2012, 4:42:04 AM2/20/12
to mongodb-user
Hi there! More questions :)

1. Is there going to be BSON, GridFS support soon?
2. Would you get your own google group?

Thanks

On Feb 14, 1:57 am, Christopher Coté <ch...@entropealabs.com> wrote:
> I'm writing to let people know I've released a shiny new persistence
> framework for Python and MongoDB.
>
> It's called Humongolus.https://github.com/entone/Humongolus

Christopher Coté

unread,
Feb 20, 2012, 11:05:40 AM2/20/12
to mongodb-user
Voltron, I've created a google group here http://groups.google.com/group/humongolus

Also, I'll see about adding in BSON, GridFS and Binary fields soon.

I got started on the Form widget, pretty basic right now, think it
needs a little re-factoring.

Christopher Coté

unread,
Feb 25, 2012, 1:08:28 PM2/25/12
to mongodb-user
A quick update, I've updated the Form widget system , it's pretty
robust now.

Also added a File field, basically a thin wrapper around the GridFS
class.

Documentation is also coming along.

Sphinx seems to have some issues with virtualenv, I'll be looking into
it a bit more.

On Feb 20, 10:05 am, Christopher Coté <ch...@entropealabs.com> wrote:
> Voltron, I've created a google group herehttp://groups.google.com/group/humongolus
>
> Also, I'll see about adding in BSON, GridFS and Binary fields soon.
>
> I got started on the Form widget, pretty basic right now, think it
> needs a little re-factoring.
>
> On Feb 20, 3:42 am, Voltron <nhy...@googlemail.com> wrote:
>
>
>
>
>
>
>
> > Hi there! More questions :)
>
> > 1. Is there going to be BSON, GridFS support soon?
> > 2. Would you get your own google group?
>
> > Thanks
>
> > On Feb 14, 1:57 am, Christopher Coté <ch...@entropealabs.com> wrote:
>
> > > I'm writing to let people know I've released a shiny new persistence
> > > framework forPythonand MongoDB.

Christopher Coté

unread,
Apr 26, 2012, 11:42:20 AM4/26/12
to mongod...@googlegroups.com
Hey guys, just an update.

I've tagged version 1.0.0 on Github and it's also on the PyMongo tools page.

Hope you get some time to play with it, I think it's a great framework ;)

Christopher Coté

unread,
Apr 26, 2012, 11:42:56 AM4/26/12
to mongod...@googlegroups.com
oh and the github page is here. http://entone.github.com/Humongolus/
Reply all
Reply to author
Forward
0 new messages