3 ms·
>"It's often more complicated than that and doing it in a non-sql way is suboptimal/unmaintainable." It's also more composable, if you ask me. I like to think
by zo1 11y ago
>"It's often more complicated than that and doing it in a non-sql way is suboptimal/unmaintainable."
It's also more composable, if you ask me. I like to think of it like "building" SQL statements using smaller components. Just like you do with code, you essentially compose a complicated business process using smaller blocks.
It's beautiful in it's simplicity. Even if the syntax requires some extra work/learning.
- justsomedood 11y agoThis is such a huge advantage for the approach. It makes it so much easier to build a query with variable filters than using SQL text.
- aidos 11y agoI've just been using this to my advantage on a system I'm working on. I've created a bunch of base queries that map from my user account table to each different table that users have access too. I can then use these base queries as a starting point to make sure people don't access records that don't belong to them. bq = db.query(Obj).join(ParentA).join(ParentB).join(User).filter(User.id==bindparam('user_id')) q = bq.filter(other_rules).params(user_id=1)... It's a really flexible system.