Re:Repeating Yourself Thrice Doesn’t Turn You into a 3x Deve...
by actionfromafar on Sunday July 30, 2023 @06:07PM
(#36936493)
Query builders are a good golden path for me. Just SQL but extra hand holding in type coercion and syntax.
Re:Repeating Yourself Thrice Doesn’t Turn You into a 3x Deve...
by dkarl on Monday July 31, 2023 @11:23AM
(#36943990)
I think query builders can be very helpful in a language with a good type system. The only times I haven't used raw SQL and didn't feel like it was a massive mistake were when using Scala, via Slick and Quill.
Re:Repeating Yourself Thrice Doesn’t Turn You into a 3x Deve...
by dkarl on Monday July 31, 2023 @11:27AM
(#36944074)
There's a tool called PugSQL that looks promising for Python, but it seems that async isn't directly supported yet[0]. If I ever find time, I'd love to jump on this and make it work, but nobody should hold their breath for that.
Write the raw SQL and then generate the boilerplate from that.
This has very few surprises because it’s a bottom up approach. And even better: you can do the exact same thing by hand.
There’s tools/libs that help with that like hugsql (Clojure) or sqlc (Go and other languages).
Doing it top down (ORM etc.) is what can cause so many problems outside of the happy path and trivial cases. These tools basically need to reinvent SQL and map it into a procedural language.
Just use SQL!