by fernandohur on 6/21/23, 12:27 PM with 63 comments
by sdcoffey on 6/21/23, 3:13 PM
by yashap on 6/21/23, 2:32 PM
Also, a query builder with generated types that match the DB schema has many of the advantages of an ORM, with IMO few of the disadvantages. I’m not spending so much time trying to figure out how to translate what I want to do in SQL into the ORM language, as it’s basically a thin, more type safe and composable layer over SQL.
by beders on 6/21/23, 4:46 PM
The majority of your SQL will not require building dynamic where clauses or (dog forbid) dynamic joins.
Having your SQL as plain statements with simple placeholders (to create safe prepared statements) is the saner approach.
Not only can you pluck them into your favorite SQL tools and analyzers, but you will not be surprised by terribly performing queries, because you created them dynamically without understanding their complexity.
We've learned the hard lessons decades ago by misusing ORMs. While using alternative SQL syntax builders is avoiding many of those pitfalls, you will still inherit complexity by translating a SQL dialect to the builder pattern.
It is not worth it IMHO.
by paraph1n on 6/21/23, 2:49 PM
by torte on 6/22/23, 1:30 AM
What has been a bit non-intuitive for me though is the expression builder since the latest major version of kysely. When writing queries with `OR` conditions it always takes me a while to wrap my head around it again. It is also challening to make this easily readable with lots of dynamic `OR` conditions and I usually end up with a wrapper function which returns the array for the statements passed into the `or(` block. Could be improved in my opinion, otherwise a great tool
by paulbares on 6/22/23, 4:35 AM
https://github.com/squashql/squashql/blob/main/documentation...
by bzzzt on 6/21/23, 2:29 PM
by peterisdirsa on 6/21/23, 2:22 PM
by idbehold on 6/21/23, 4:16 PM
by LewisJEllis on 6/21/23, 7:30 PM
Had lots of good experiences working with Knex.js over the years, and Kysely is the TS-native spiritual successor to Knex.
by afavour on 6/21/23, 4:04 PM
by sickcodebruh on 6/21/23, 4:45 PM
I’m excited. I enjoy Prisma but SQL can be so expressive. Looking forward to trying this.
by eevo on 6/21/23, 4:41 PM
I guess I still prefer that to a full on ORM, but that's really the one missing feature I want from these SQL query builder libraries
by threatofrain on 6/21/23, 5:23 PM
https://github.com/drizzle-team/drizzle-orm
I think I've reached the limits of Prisma and embarrassingly I'm thinking about ripping it out. The benefits of not having to constantly reference your DB schema and having IDE guidance is not matching up to the idiosyncrasy and incomplete DB support of Prisma.
by jadbox on 6/21/23, 8:20 PM
by ghnws on 6/21/23, 4:02 PM
by igalklebanov on 6/21/23, 6:45 PM
Igal from Kysely here (I did not create it, Sami did).
Our site is a constant WIP. We've recently revamped "Getting Started" and added a lot of examples. If you can't find something there, check the API docs site or JS docs in your IDE - everything is documented.
We respond quite fast on discord if you've got any questions.
Feel free to ask me questions here too. :)
by programmarchy on 6/21/23, 5:23 PM
by igalklebanov on 6/21/23, 7:52 PM
by gareve on 6/21/23, 5:43 PM
I'm trying to think what happens when a column gets deleted or added in the prod, ci, or dev db tier. Ideally those db schema changes should happen at the same time but real life doesn't work like that.