I'm always confused by the notion of Many-to-many in those fancy ORM:s. Creating secret tables behind my back, making me wondering how to get stuff from them. I like my plain SQL. A luddite and a retrograde.
I'm always confused by the notion of Many-to-many in those fancy ORM:s. Creating secret tables behind my back, making me wondering how to get stuff from them. I like my plain SQL. A luddite and a retrograde. 4 comments
ORM is great for what its name stands for — mapping! It is almost impossible to make typo in table names, fields or whatever. But sadly some tricky sql queries (and creation of rel-tables) must be done in raw SQL (ANSI SQL preferably), because it is clear and explicit. @danilax86 I like how JetBrains IDE:s provide autocomplete for SQL, bringing it closer to ORM. The best thing is automatic migrations... So cool. We had this discussion, right? @bouncepaw i like how it's solved with Elixir Ecto where many to many relationships are explicitly defined when defining tables, inserts or queries. Ecto is slightly above SQL but not much. |
@bouncepaw ORMs are in my mental category of "almost always the wrong solution". I'm wary of sticking raw SQL into application code as a matter of course, but I think a query builder is the sweet spot. I've not yet seen a use case that convinced me an ORM was the right choice.
(That said, for personal projects I mostly get away with a very thin data layer that just maps function calls to static SQL strings w/ parameters.)