SQL is great for what it does, but I use ORMs for reasons other than writing queries in a different way. I inherited an utter mess of a schema that wasn't even remotely close to 1NF. Imagine fields containing comma-joined sets of values, and with column names not even remotely related to what they actually held. For legacy and business purposes, updating the schema was a non-starter.
So I used SQLAlchemy to remap the schema into something usable. I wrote getters that split out those comma-joined fields and returned the desired value against tables that required indexes like:
I wrote (and therefore more importantly _documented_) the bizarre and complex way some of the tables joined together. I wrote something that was unit-testable and that could be used as a foundation for other work so that I wouldn't have to memorize the insane corner cases and reproduce them from scratch each time I needed to access the data in some little-used table.
I _didn't_ write a more convenient way to say `SELECT * FROM blog`. In general, that doesn't interest me and I wouldn't have bothered with it. ORMs are great - if used well! - for encapsulating all of the little bits of business cruft in one central, easy-to-manage place. They're handy for roughly the same reasons that subroutines are handy.
This is an interesting use and I like the idea, but I don't think it makes him wrong. You don't actually need an ORM to do this. The same logic could be applied to data sets retrieved through regular queries. Or you could create views/stored procedures with the same logic.
SQL is great for what it does, but I use ORMs for reasons other than writing queries in a different way. I inherited an utter mess of a schema that wasn't even remotely close to 1NF. Imagine fields containing comma-joined sets of values, and with column names not even remotely related to what they actually held. For legacy and business purposes, updating the schema was a non-starter.
So I used SQLAlchemy to remap the schema into something usable. I wrote getters that split out those comma-joined fields and returned the desired value against tables that required indexes like:
I wrote (and therefore more importantly _documented_) the bizarre and complex way some of the tables joined together. I wrote something that was unit-testable and that could be used as a foundation for other work so that I wouldn't have to memorize the insane corner cases and reproduce them from scratch each time I needed to access the data in some little-used table.I _didn't_ write a more convenient way to say `SELECT * FROM blog`. In general, that doesn't interest me and I wouldn't have bothered with it. ORMs are great - if used well! - for encapsulating all of the little bits of business cruft in one central, easy-to-manage place. They're handy for roughly the same reasons that subroutines are handy.