by wsc981 on 9/8/24, 8:04 AM with 104 comments
by seer on 9/10/24, 4:17 AM
There is so much more to rdbms (especially pg) than just joins - common table expressions, window functions, various views, let alone all the extensibility - extensions, custom types, even enums.
All of that can enable writing performant, type safe and very compact applications.
I am yet to see libs that embrace the elegance of it all - I’ve attempted this once - https://github.com/ivank/potygen but didn’t get much traction. I’m now just waiting for someone more determined to pick up those ideas - a client lib that exposes the type safety and intellisence at compile time and allows you to easily compose those sql queries.
I think this project has some ways to go to reach that though, but thankfully it is a step in the right direction.
by tlonny on 9/10/24, 7:19 AM
It is a query builder (not an ORM), that (ab)-uses the Typescript type system to give you full type safety, intellisense, autocomplete etc.
Crucially it doesn’t require any build/compile step for your queries which is fantastic.
by geoka9 on 9/9/24, 10:30 PM
by limaoscarjuliet on 9/10/24, 2:18 PM
Example C code (requires ECPG pre-compilation step):
EXEC SQL BEGIN DECLARE SECTION; int v1; VARCHAR v2; EXEC SQL END DECLARE SECTION;
...
EXEC SQL DECLARE foo CURSOR FOR SELECT a, b FROM test;
...
do { ... EXEC SQL FETCH NEXT FROM foo INTO :v1, :v2; ... } while (...);
by pier25 on 9/9/24, 10:36 PM
by gzel on 9/10/24, 6:34 AM
by MaxRS on 9/9/24, 10:48 PM
https://github.com/helpwave/services/tree/main/services/task...
by petcat on 9/9/24, 11:10 PM
by jelder on 9/10/24, 4:29 PM
by ruuda on 9/10/24, 6:06 AM
by dagss on 9/9/24, 11:25 PM
by taeric on 9/9/24, 11:43 PM
I remember using https://sqlfairy.sourceforge.net/ back in the day to help test locally against mysql/postgres, but deploy to oracle. There were hiccups, but it felt like the world would mostly converge onto smaller differences between the offerings and that kicking off a test database on every build should be easier as time goes on.
Instead, it feels like we have done as much as we can to make all of this harder. I loved AWS Athena when I was able to use it, but trying to figure out a local database for testing that supported the same dialect it used seemed basically impossible. It was baffling.
by nobleach on 9/10/24, 2:12 PM
by dangoodmanUT on 9/9/24, 10:39 PM
by blipWER on 9/10/24, 11:12 AM
by RamiAwar on 9/9/24, 11:25 PM
This kind of generates the type safe queries for you, which is the end goal. But then why don't developers use the query builder instead? Why have an unnecessary generation step?
I feel like a good query builder ORM is more than enough and more straightforward than this. What am I missing?
by sorenbs on 9/10/24, 8:53 AM
Coincidentally, we just released support for this in Prisma a few weeks ago: https://www.prisma.io/blog/announcing-typedsql-make-your-raw...
by Thaxll on 9/9/24, 11:48 PM
by golergka on 9/10/24, 4:29 PM
by giovannibonetti on 9/9/24, 11:13 PM
by michaelmdresser on 9/10/24, 3:06 AM
by vegancap on 9/10/24, 8:05 AM
by happyweasel on 9/10/24, 3:54 PM