| ▲ | AnotherGoodName 11 hours ago | ||||||||||||||||
Using an ORM and escape hatching to raw SQL is pretty much industry standard practice these days and definitely better than no ORM imho. I have code that's basically a lot of
It's as optimal as any other raw SQL query. Now that may make some people scream "why use an ORM at all then!!!" but in the meantime;I have wonderful and trivially configurable db connection state management I have the ability to do things really simply when i want to; i still can use the ORM magic for quick prototyping or when i know the query is actually trivial object fetching. The result passing into an object that matches the result of the query is definitely nicer with a good ORM library than every raw SQL library i've used. | |||||||||||||||||
| ▲ | RedShift1 11 hours ago | parent [-] | ||||||||||||||||
Every project I've come across that uses an ORM has terrible database design. All columns nullable, missing foreign key indexes, doing things in application code that could easily be done by triggers (fields like created, modified, ...), wrong datatypes (varchar(n) all over the place, just wwwhhhhyyy, floats for money, ...), using sentinel values (this one time, at bandcamp, I came across a datetime field that used a sentinel value and it only worked because of two datetime handling bugs (so two wrongs did make a right) and the server being in the UTC timezone), and the list goes on and on... I think this happens because ORMs make you treat the database as a dumb datastore and hence the poor schema. | |||||||||||||||||
| |||||||||||||||||