News for hackers. Stuff that matters.
Re:The Zen of Python by Example by suraj on Friday February 11, 2011 @01:29AM (#2205413)
I do not like example 4 "Complex is better than complicated". Use of string concatenation is going to lead to SQL injection bugs and SQLAlchemy version actually looks better to me.

Can somebody please enlighten me on how using raw sql is preferable?

Re:The Zen of Python by Example by Luyt on Saturday February 12, 2011 @07:49AM (#2209931)
You could use dbapi's query parametrisation instead of string concatenation, or maybe use sqlalchemy's SQL Expression if you don't want to write SQL.

ORMs are not a panacea. Especially when the database schema gets more complicated they require more setup and tuning, and there's always the problem of how much data the ORM should suck in vs. how lazy it can behave.