Remix.run Logo
tracker1 3 days ago

I'm more a fan of just a sql template string handler... in C#/.Net I rely on Dapper... for node, I like being able to do things like...

    const results = await query`
      SELECT...
      FROM...
      WHERE x = ${varname}
    `;
Note: This is not sql injection, the query is a string template handler that creates a parameterized query and returns the results asynchronously. There's adapters for most DBs, or it's easy enough to write one in a couple dozen lines of code or less.
breakfastduck 3 days ago | parent | next [-]

Sure, looks good. I often do templating.

However drizzle makes it very very straightfoward to handle DB migration / versioning, so I like it a lot for that.

tracker1 3 days ago | parent [-]

I mostly use grate.

pier25 3 days ago | parent | prev [-]

With something like EF Core in .NET or Drizzle in TS you get a lot of help from your editor that you wouldn't get when writing SQL.

tracker1 3 days ago | parent | next [-]

In TS, I can still create a type for my result... const results : Promise<Foo[]> = ...

I'm not sure what additional help you're getting. I'm just not a fan of ORMs as they tend to have hard edges in practice.

pier25 3 days ago | parent [-]

ORMs not only help with the result of the query but but also when writing queries. When I wrote SQL I was constantly checking table names, columns, and enums. With a good ORM like EF Core not only you get autocomplete, type checking, etc but dealing with relationships is much less tedious than with SQL. You can read or insert deeply nested entities very easily.

Obviously ORMs and query builders won't solve 100% of your queries but they will solve probably +90% with much better DX.

For years I used to be in the SQL-only camp but my productivity has increased substantially since I tried EF for C# and Drizzle for TS.

tracker1 3 days ago | parent [-]

VS Code plugs into my DB just fine for writing SQL queries...

With an ORM, you can also over-query deeply nested related entities very easy... worse, you can then shove a 100mb+ json payload to the web client to use a fraction of.

mrsmrtss 3 days ago | parent [-]

That's just nonsense. It's trivial to make efficient projected queries with ORMs like EF. Nothing stops you doing stupid things with plain SQL either.

tracker1 3 days ago | parent [-]

No, but it does put you closer to the actual database and makes you think about what you're actually writing. You also aren't adding unnecessary latency and overhead to every query.

pier25 3 days ago | parent [-]

Better DX is not unnecessary.

Also the overhead of good ORMs is pretty minimal and won't make a difference in the vast majority of cases. If you find a bottleneck you can always use SQL.

pjmlp 2 days ago | parent | prev [-]

Only if using the wrong kind of editor.