This is from a facebood post Mehmet Ali 'mali' Akmanalp. These are two comments written by Mehmet Ali 'mali' Akmanalp:
Matt: so with SQLAlchemy the point is that the ORM is laid on top of this lower level SQL generator, so when the ORM is too specific and you need to fall back, you don't have to concatenate strings and you can generate syntactically correct and safe SQL through code. Check it: http://docs.sqlalchemy.org/en/rel_0_9/core/tutorial.html (scroll down for cooler examples).
Matt: let me give you an example from what I'm working on now. So let's say you have a generic query for fetching monthly aggregated import / export values between countries. Sometimes you want to filter by one country. Sometimes you want to filter by 10 countries. Sometimes you want to use the column containing the inflation-adjusted value instead of the regular column. Sometimes you want the average export instead of the total export.
With a low level abstraction layer, I can do stuff like already_complicated_query.fi