Dejavu, a pythonic ORM (PyCon presentation)

http://pycon.blip.tv/file/1949237/
by olifante • 17 years ago
3 1 17 years ago

Very interesting presentation! Dejavu is an ORM similar to SQLAlchemy and Django Models. It has a lovely pythonic syntax for doing queries with lambda expressions, e.g.:

box.recall(Comic, lambda c: 'Hob' in c.Title or '#' in c.Title)

Instead of for instance Django's

Comic.objects.filter(Title__contains='Hob') | Comic.objects.filter(Title__contains='#')

I also loved the approach to converting the python queries to SQL code: Dejavu converts the python queries into an AST, which is then deparsed into the desired SQL dialect, an approach that apparently was used long ago by Glorp, a Smalltalk ORM.

Dejavu can also work with non-relational backends, such as flatfiles, LDAP stores, memcache, RAM and even the Python shelve.

In the question round, Robert also showed a very simple syntax for joins:

Table1 & Table2 represents an inner join. Table1 | Table2 represents an outer join. Table1 << Table2 represents a left join.

One question that was left unanswered was whether Dejavu supports the distributed key-value stores that are becoming increasingly popular, such as CouchDB, Amazon S3 and Amazon SimpleDB.

Related Stories

Loading related stories...

Source preview

pycon.blip.tv