Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Never understood why people use abstractions on SQL. SQL in itself is plain, simple, easy to use. No need for any high level abstractions. If you ever get next to a mysql console you can shove your abstractions up your wahzoo. If you know the basic level thing you can do whatever you want, in whatever environment you are in.


I think the main problem is getting compile time errors and autocomplete for your queries. Something like Kysely doesn't fully solve this but it avoids dumb errors like typos in sql commands or hanging commas. That being said, writing pure sql with Jetbrains IDEs is pretty amazing since you can get autocomplete straight from your production db schema. We use sqlx in Go + pure SQL and it works pretty well. Very simple things take slightly longer but writing complex queries is more straightforward than trying to get the builder to do the right thing.


Oh man :DDD. You must be joking, right? :D


Can you elaborate? Writing SQL and having the library only take care of converting from/to classes (or structs or whatever) in your code is common in various communities. What's so weird about it?


One key thing is that a variety of query builders and ORMs - I'd point to TypeORM for JS/TS, for example - allow in-IDE verification against a set schema and type inference of the results in whatever language you're working in.


Ah, too much oo and type magic. 90% of things do not need those, it just increases development time many times fold.


Query builders are a slight annoyance at worst, while ORMs can easily screw up the foundation of your system. You get extra compile-time checks with a query builder if you're using TS (a big piece of bloat on its own) instead of JS, which can be nice, but that's also what tests are for.


:DDDD




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: