Async MongoDB ORM on top of Motor and Schematics.

357 views
Skip to first unread message

wsantos

unread,
Apr 17, 2014, 3:02:04 PM4/17/14
to python-...@googlegroups.com
Hi all,

I Made a module to work with MongoDB with a ORM Style putting together these two modules, I name it MotORM and here is the github link https://github.com/wsantos/motorm, i have been using this in a personal production site, and it is pretty handy, please let me know your thoughts about it, and any help would be appreciated.

Big Respect,
Waldecir

A. Jesse Jiryu Davis

unread,
Apr 17, 2014, 4:02:08 PM4/17/14
to python-...@googlegroups.com
Neat!


--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornad...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Adrià Saborit

unread,
Dec 12, 2015, 8:36:21 AM12/12/15
to Tornado Web Server
Hi Waldecir,

This is exactly what I was looking for but unforntanetely I can't make it work:

import tornado
from motorm import *
from schematics.types import StringType, URLType

class Person(AsyncModel):
id = StringType
name = StringType(required=True)
website = URLType()


connect('Test')

@tornado.gen.coroutine
def test():
person = Person()
person.name = "Jonny Bravo"
person.website = "http://google.com"
yield person.save()

test()

C:\Python34\python.exe D:/Development/pycharm/motorm/main.py
Future <tornado.concurrent.Future object at 0x035E5AF0> exception was never retrieved: Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\tornado\gen.py", line 282, in wrapper
    yielded = next(result)
  File "D:/Development/pycharm/motorm/main.py", line 18, in test
    yield person.save()
  File "C:\Python34\lib\site-packages\tornado\concurrent.py", line 473, in wrapper
    future.result()
  File "C:\Python34\lib\site-packages\tornado\concurrent.py", line 232, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 3, in raise_exc_info
  File "C:\Python34\lib\site-packages\tornado\concurrent.py", line 461, in wrapper
    result = f(*args, **kwargs)
  File "D:\Development\pycharm\motorm\motorm\__init__.py", line 192, in save
    isinstance(self.id, ObjectId) else self.id
  File "C:\Python34\lib\site-packages\bson\objectid.py", line 92, in __init__
    self.__validate(oid)
  File "C:\Python34\lib\site-packages\bson\objectid.py", line 200, in __validate
    text_type.__name__, type(oid)))
TypeError: id must be an instance of (bytes, str, ObjectId), not <class 'schematics.types.base.TypeMeta'>

Process finished with exit code 0

I'll appreaciate any idea.

Many thanks!

Kind regards,
Adrià

El dijous, 17 abril de 2014 21:02:04 UTC+2, wsantos va escriure:

Waldecir Santos

unread,
Dec 12, 2015, 12:51:34 PM12/12/15
to Tornado Web Server
Sure, I didn't test it with Python 3, I'll investigate it today or tomorrow, can you fill a issue in github ?

Best regards,
Waldecir

--

A. Jesse Jiryu Davis

unread,
Dec 12, 2015, 1:18:46 PM12/12/15
to python-...@googlegroups.com
I don't know Waldecir's code, but at a glance it looks like you might need to replace:

   id = StringType

... with:

   id = StringType()

Adrià Saborit

unread,
Dec 12, 2015, 10:01:37 PM12/12/15
to Tornado Web Server
Thank you both. I have opened the issue in Git.

@Jesse, you are right () was missing but there is still something not working... I have put the details on Git.

Thank you,
Adrià

El dissabte, 12 desembre de 2015 19:18:46 UTC+1, A. Jesse Jiryu Davis va escriure:

Peng Dai

unread,
Dec 16, 2015, 12:56:11 AM12/16/15
to Tornado Web Server
nice job.
Reply all
Reply to author
Forward
0 new messages