Viewing a single comment thread. View all comments

flabberghaster wrote

I'm kind of surprised they're that hard to work with. I've never used one, just hasn't come up in any of the projects i've been on; But i'd expect them to have some escape hatch. Something where you'd be able to just give it an SQL query you want to run, as a prepared statement or something, tell it some variables to put in, maybe tell it what types it would return, depending on the language, and just have it run it.

Do they not? Or is it just impractical to use somehow?

2

musou OP wrote

yeah most of the ones i have used do have the ability to execute raw SQL queries, which is how i solved the problem i had the other day. but you lose a lot of the benefit of using the ORM in the first place, you usually have to handle query pagination, input sanitization, and casting the response (which usually comes back as a 2D list of primitives) to the appropriate data structures yourself.

and just as bad, the code now has inconsistency in it. i never feel good about doing the same thing two different and incompatible ways.

2