Hacker News new | past | comments | ask | show | jobs | submit login
SqlAlchemy: ORM vs. Core expression language
2 points by Jaigus on April 16, 2013 | hide | past | favorite
I'm in the process of writing a forum-like discussion component for a larger web application, and I am debating on whether or not I should use the full sqlalchemy ORM, or just the expression language. Using the expression language(the underlying part of sqlalchemy which the ORM is built upon), I planned to take a general table data gateway approach (http://martinfowler.com/eaaCatalog/tableDataGateway.html), creating simple and light-weight data-access-objects (e.g. UserGate, TopicGate, PostGate, etc) that will serve as the data-access layer.

The expression language protects against injection attacks, handles connection pooling, and also provides a nice way of generating the sql queries (e.g. usergate.select(whereclause=(usergate.c.id == userid)).execute() ). However, this approach will certainly necessitate more boilerplate code; I am wondering if this is acceptable since it will use much less internal function calls than the ORM.

I'd greatly appreciate some feedback, especially from people who have used sqlalchemy core to implement a custom data-access layer.

I read this article, but didn't get that much information from it tbh: http://stackful-dev.com/discovering-sqlalchemy-core-the-relational-nosql-api-for-python.html




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: