3 ms·
But why do you need these containers of data, when you could have more direct access to both the data itself and the whole set (not individual objects, nor col
by zkomp 9y ago
But why do you need these containers of data, when you could have more direct access to both the data itself and the whole set (not individual objects, nor collections of objects)
I dont like ORMs but did struggle some years trying to use them which imho was a detour. SQL and stored procedures in plpgsql is so much better, easier to maintain, easier to reason about etc.
- icebraining 9y agoHow would you calculate the average of the sum of three columns (AVG(A + B + C)) which are chosen by the user at runtime?
- zkomp 9y agoI personally would write a simple plpgsql stored procedure, but I would not trust user input and only allow a defined set of colums from a defined set of tables. you can have lots of dynamic sql but that might become a rabbithole, just as with an ORM. It sounds like a problem you shouldnt have, now throwing an ORM at such a problem... might lead to even more strange issues down the road...
- icebraining 9y agoI personally would write a simple plpgsql stored procedure, but I would not trust user input and only allow a defined set of colums from a defined set of tables. Sure, you can limit it to a single table and to a certain set of columns e.g. A B C D E. Can you give me an example of a simple plpgsql stored procedure to do this? you can have lots of dynamic sql but that might become a rabbithole, just as with an ORM That's not my experience. In a language with good introspection and/or where most entities are first-class, you can do this rather easily. In Python that would take two or three short lines. It sounds like a problem you shouldnt have This is a bit of a cop-out :) allowing the generation of simple reports configured by the user is a typical need for us.