Re: little_pger.py (a thin layer a tad above SQL and psycopg2)

From: "A(dot)M(dot)" <agentm(at)themactionfaction(dot)com>
To: psycopg(at)postgresql(dot)org
Subject: Re: little_pger.py (a thin layer a tad above SQL and psycopg2)
Date: 2012-12-19 16:29:27
Message-ID: 11F18366-BCA7-4429-8721-246C6E5AD540@themactionfaction.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: psycopg


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.html and esqueleto http://hackage.haskell.org/package/esqueleto which are domain-specific languages which compile to SQL. I, too, have been looking for something lightweight and quick which would allow nearly-automatic JSON generation from database rows. The trickier part is recursing a model attribute tree which always leads me back to SQLAlchemy.

Cheers,
M

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message Rory Campbell-Lange 2012-12-19 16:53:18 Re: little_pger.py (a thin layer a tad above SQL and psycopg2)
Previous Message Christian Jauvin 2012-12-18 17:27:20 little_pger.py (a thin layer a tad above SQL and psycopg2)