Question

I would appreciate hearing some opinions on the best approach to creating a light-weight data mapping layer between some python objects and a postgres database. I'm using the psycopg2 library, and plan to use pgbouncer. I looked at this: http://codeinthehole.com/writing/domain-model-mapper-a-php-data-mapper-implementation/ for a basic idea, but it isn't clear how they are closing the connection after the queries. The component I'm building is similar to a forum in that it has your familiar user, post, forum tables, etc.

Was it helpful?

Solution

The best approach is not to create a new layer, but to use an existing one. SQLAlchemy is the most full-featured, but others are also good, such as Storm.

Maybe you could explain why you want to write a new one?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top