Skip to content
Stand With Ukraine

Comparing with Kysely

Kysely is a query builder, not an ORM, in a sense that by design it is not responsible for relations and other features that you can find in ORMs. Yet, it makes sense to compare OrchidORM with it because both libraries provide ability to construct complex queries, with a big respect to type-safety.

OrchidORM took inspiration from Kysely. Being not less flexible and type-safe than Kysely is one of the project goals. Not all features of Kysely are covered yet, for example, case-when SQL builder.

OrchidORM only supports PostgreSQL database, while Kysely supports many different ones.

OrchidORM returns many records by default, so no need for execute().

You can use take, takeOptional for executeTakeFirstOrThrow and executeTakeFirst of Kysely.

There are also get for a single value, pluck for a flat array, and other options.

OrchidORM

sql
SELECT
  "person"."id"
FROM
  "person"
WHERE
  "person"."firstName" = $1;
-- Parameters:
-- $1: "Arnold"

Kysely

sql
select
  "id"
from
  "person"
where
  "first_name" = $1;
-- Parameters:
-- $1: "Arnold"