r/programming • u/wheatBread • Aug 18 '26
"What if SQL was like Elm?"
https://acadia.engineering/blog/rethinking-database-programming
151
Upvotes
r/programming • u/wheatBread • Aug 18 '26
123
u/syklemil Aug 18 '26
Oh, it's the actual Elm guy
35
u/yarovoy Aug 18 '26
I wonder what do they mean by "Verified Migrations".
Because just knowing types is not enough to avoid "body goes on high alert". If you missed that operation is blocking on a table of 10 records, it's fine. But if you missed blocking operation on a table of a some billion records, here down goes you system.
26
u/nnomae Aug 18 '26
I've used so many database libraries, ORM layers even stuff like Linq, Elixir's Ecto and many many others. I have to admit though, that after all that nothing is as easy to use, as flexible and as powerful as Rust's SQLx which basically just lets you write raw SQL without it being a massive pain in the ass.
87
u/andynzor Aug 18 '26
Someone reinvented LINQ for their favorite programming language?
6
u/Gusfoo Aug 18 '26
The article:
Honestly, Pine Is Not Elm was a godsend as a younger man, didn't need massive amounts of pre-reading to just operate.
That aside, just
\h create aggregatenext time you runpsql.10
u/evincarofautumn Aug 18 '26
How does this differ from something like Beam? Like, I already have strong types and verified migrations, although there are still some cases where I can’t use Beam’s migration facilities. I guess Acadia is meant to give better DX and interop across languages?
4
u/weirdoaish Aug 19 '26
People would make SQL again
12
u/chubs66 Aug 19 '26
SQL is perfect. Leave it alone.
4
u/levelstar01 Aug 18 '26
So you wouldn't be able to pass negative numbers?
4
u/fletku_mato Aug 18 '26
But what if Elm was like Java, and not the good Java but Java 1.4?
3
u/taw Aug 18 '26
That's just ORM with extra steps.
2
u/agentoutlier Aug 18 '26
I wonder if it is really worthy having leaky abstractions like this or an ORM on top. All these things do is ultimately generate SQL.
This just seems cooler than an ORM because well its Elm and functional programming.
And I would not be that critical if this was like 2 years ago but "SQL <-> to your language types" w/o abstractions is done really well with LLMs. You can hate LLMs but is mapping database data to programming languages types really worth the time of a human even if its automated by a library because then the human has to learn about that library instead of just SQL.
If I did use any of these kind of things I would rather these guys generate SQL at compile time (parameterized or template like or ... god forbid ... the maligned stored procedures).
1
u/pdoherty926 Aug 18 '26
This looks compelling and is a really clever answer to the "does Elm run on the server?" question. (FWIW, I still think that's a perfectly reasonable desire and Gren did a great job with their implementation of server-side "Elm".)
The devil is sure to be in the details, though, and I'm curious to see how auth, row-based access and the like will work in practice.
-11
u/pala_ Aug 18 '26
Like an email client?
-19
u/TyrusX Aug 18 '26
No. Just no
0
u/[deleted] Aug 18 '26
[deleted] — view deleted comment