I need a way to run a parameterized query as part of a Kysely transaction
query(query : string, params: unknown[])
. AFAICT there is no way for me to run a parameterized query with the kysely DB instance?
Worst case scenario
, I can manually manage the pool/transactions myself and wrap the client in a Kysely object but that certainly would not be ideal......Generic Kysely Client
Custom joins (probably raw)
Select by many IDs query with order based on input
(VALUES (?),(?),
...)
, but i don't know how to type the raw sql part so the output doesn't have any
please see https://kyse.link/tPC0N
thanks in advance...Reference proper table names when using schema prefix
schema.table
, when you want to selectFrom('schema.table')
the actual name that should be used to refer to the table later in the query, should be table
and not schema.table
. Using the complete path results in errors depending on the actual query shape.
From my understanding, when you refer to a table by its full path, adding the schema prefix, you're just referencing it, but the name that's actually saved in the query scope to refer back to it, doesn't have the schema prefix anymore.
An example would be:...MERGE INTO using arbitrary values
Transaction is necessary in the migration file?
Strange error while inserting
How can I use `->>` and `->` operators with ExpressionBuilder?
eb(ref("table.column"), "->", eb.lit("foo"))
, but this does not work because "->"
is not recognized as a valid operator. How do I do this without using raw SQL templates?ref("table.column", "->>").key("foo")
.Deferrable on unique indexes and constraints
I need to extract the type of eb in the query chain
selectFrom or getExecutor not a function with custom dialect.
selectFrom
or with sql.raw().execute(db)
):
- selectFrom is not a function
- executorProvider.getExecutor is not a function
...Can't figure out how to add a unique index on (foo, LOWER(bar)) for a table
Using AsyncLocalStorage to Propagate Transaction Context
with-transaction.ts
:
```ts...How to make general purpose queries?
Joining multiple separate CTE's
union
with a subquery conditionally tho, as the result shape is already established, and union
can be added to existing builder instances, outside of chain (but also with $call
)....Is this a correct situation to use $castTo (jsonArrayFrom + Left Join)
Inconsistent Typing of NUMERIC Fields with jsonBuildObject
Date
.
What's puzzling is that this behavior isn't consistent across all data types. For instance, NUMERIC
values at the root level are returned as strings
(which is fine), but when those same values appear inside a nested JSON object, their type is inferred as number
instead. I would prefer to have NUMERIC
values inside JSON objects returned as string
to keep it consistent with how they are handled at the root level....AggregateFunctionBuilder inside a SUM
SUM(CASE WHEN IsNoShow = 0 AND IsDNA = 0 THEN 1 ELSE 0 END)
SUM(CASE WHEN IsNoShow = 0 AND IsDNA = 0 THEN 1 ELSE 0 END)
100
instead of number
for eb.lit(100)
...