On Dec 18, 2012, at 12:27 PM, Christian Jauvin wrote:
> Hi,
>
> A couple of years ago, when I first studied the possibility of using a
> Python ORM for a project, I rapidly got the impression that they were
> (1) too heavy and complicated and (2) abstracting away SQL in an
> "unhealthy" way. I think I was also influenced by this blog article:
>
> http://database-programmer.blogspot.ca/2008/06/why-i-do-not-use-orm.html
>
> Maybe that judgment was a bit quick, but as I always liked pure SQL
> anyway, I decided to stay happy with psycopg2, and I never looked
> back.
>
> However, as I was developing CRUD web apps, where you're basically
> exchanging JSON data between the UI and the database, I began hiding
> the manipulations required to compose my queries with simple
> functions, all operating on plain data structures, and using psycopg2:
>
> https://github.com/cjauvin/little_pger
I think this is very similar in spirit to SQLAlchemy's SQL expression library
http://docs.sqlalchemy.org/en/rel_0_8/core/tutorial.htmland esqueleto http://hackage.haskell.org/package/esqueleto
whichare domain-specific languages which compile to SQL. I, too, have been looking for something lightweight and quick
whichwould allow nearly-automatic JSON generation from database rows. The trickier part is recursing a model attribute
treewhich always leads me back to SQLAlchemy.
Cheers,
M