from Hacker News

Ask HN: Who writes plain SQL in production?

by htunnicliff on 3/18/24, 3:49 PM with 7 comments

Does anyone write “plain” SQL queries in production web apps, as opposed to using an ORM? I ask because I’ve only ever worked at companies using ORMs, but feel like there is a lot of simplicity in being able to write SQL directly.
  • by arcbyte on 3/18/24, 4:07 PM

    The only people I encounter using ORMs are junior devs or folks who who keep moving project to project before they get a chance to support something in production. The first time you get an issue and go "wtf" at an ORM you switch real fast.
  • by johnny99k on 3/18/24, 4:29 PM

    Every ORM I've encountered always has issues when you want to write custom SQL outside of the ORM. It turns into a real mess real fast.

    Our production code is mostly stored procedures called by code.

  • by brookritz on 3/18/24, 4:18 PM

    I always do. In a recent project with just me and another developer they added a senior/lead/architect who took over and ordered to rewrite using "enterprise" stuff including ORM. I left. Now they have more developers and code that is about shoveling data back and forth to and between layers, beans, controllers, services, adapters ...
  • by ttymck on 3/18/24, 10:19 PM

    Isn't the ORM the mapper from rows to objects? Every ORM I've used has support for "plain sql", in addition to a query builder/dsl.

    How are you deserializing query results and serializing inputs?

    For context: I work on web apps

  • by stray on 3/18/24, 4:00 PM

    Yes. I rarely use an ORM.
  • by gregjor on 3/18/24, 3:56 PM

    yes, at several jobs. never use an ORM if i can help it.
  • by jeffogbu25 on 3/19/24, 7:41 AM

    I rarely use ORM