Live data from Hacker News

Show HN: Kysely, a type-safe SQL query builder for TypeScript

kysely.dev

31–40 of 65 posts

Re: Show HN: Kysely, a type-safe SQL query builder for TypeScript

#32

I typed up a comment saying how much I’d love to drop this in alongside my Prisma code so I can keep using the ORM for simple things and have the option to drop into SQL as needed. It ended asking if anyone knew whether such a thing was possible. I decided to check the docs one more time and… here it is! https://github.com/valtyr/prisma-kysely I’m excited. I enjoy Prisma but SQL can be so expressive. Looking forward…

<3 from Kysely. prisma-kysely is dope!

Re: Show HN: Kysely, a type-safe SQL query builder for TypeScript

#33
post #4

Have recently started using it, big fan, especially in concert with kysely-codegen (generate Kysely types from DB schema). The combo is similar to Prisma, but IMO better in practice - Prisma is too limited, too little support for any sort of custom/non-standard types. For example, using PostGIS with Prisma is a terrible experience, but fine with Kysely. Also, a query builder with generated types that match the DB sch…

<3 from Kysely. kysely-codegen is really dope!

Re: Show HN: Kysely, a type-safe SQL query builder for TypeScript

#34
post #23

If you want to run SQL, write SQL. 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 d…

What sort of platonic ideal project do you work on that the majority of SQL you write doesn't need dynamic WHERE clauses? You're positing a majority use case I haven't encountered in 20 years of professional and personal projects.

Re: Show HN: Kysely, a type-safe SQL query builder for TypeScript

#35
post #23

If you want to run SQL, write SQL. 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 d…

no

continues to be productive in django

Re: Show HN: Kysely, a type-safe SQL query builder for TypeScript

#36
post #23

If you want to run SQL, write SQL. 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 d…

Maybe not the majority, but the most critical, like filter-based searches, will require some dynamic SQL. Type safety is a big win.

Re: Show HN: Kysely, a type-safe SQL query builder for TypeScript

#38
Another "almost" like SQL library that I've heard floating around:

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.

Re: Show HN: Kysely, a type-safe SQL query builder for TypeScript

#39
post #17

Has anyone used this and compared to the types provided by Knex? I’m largely very happy with Knex but when you start dealing with subqueries and the like the types fall apart. Suspect this kind of thing is pushing TS types to their limit, though.

You should try it. I switched from Knex to Kysely since I was early in a project and Knex lost its lead developer (IIRC) and the typing Kysely gives you is extremely effortless and works very well.

Re: Show HN: Kysely, a type-safe SQL query builder for TypeScript

#40
post #23

If you want to run SQL, write SQL. 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 d…

In NodeJS land this library is pretty close to this: https://github.com/porsager/postgres
Post reply on HN