Dejavu, a pythonic ORM (PyCon presentation) (pycon.blip.tv)

3 points by olifante ↗ HN
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.

1 comment

[ 0.23 ms ] story [ 17.9 ms ] thread
Very interesting presentation on Dejavu, 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.