Is there way to select every field from table using `select` instead of `selectAll`?
selectAll
does the job, but I also need to populate some relations and build json_agg
s. Is there way to either select every column from table (and then build jsonObject) or extend selectAll
with some extra fields?
```
db
.selectFrom('document')
.select((eb)=> [....selectAll('document')
.select(eb => ...)
.selectAll('document')
.select(eb => ...)
select / groupBy combined helper
How to delete and insert in one query
.filterWhere inference
.$narrowType
for this.json object relation null problem
undefined
or ?
in your type interfaces.How to narrow type from jsonArrayFrom
Single Table Inheritance
table. I believe this is possible, but after some fighting with api and syntax I am not sure how to make it.
Here is my query:
(sorry for polish, Ubiquitous Language with domain masters)
```....$narrowType<PrzyjecieZewnetrznePozycjaRozbicieSelect>()
has to be straight after jsonArrayFrom
not at the top levelHow to narrow type in select
company, person
to just person
in select query?
```
const results = await db
.selectFrom('receiver')
.where('type', '=', 'person')...$narrowType
Subquery from a function
boolean
. It's { is_friend: boolean }
. Yes, you can use that as a scalar in SQL and Kysely does handle that correctly. But don't explicitly set the wrong type.
You always need to provide a name for selections using the as
method. The name is dialect-specific if you leave it out. Since kysely types don't know which dialect you're using, providing a name for that column automatically is impossible....why is WhereNode.where any operation node?
are nested joins supported?
knex .select('*') .from('users') .join('accounts', function () { this.on(function () { this.on('accounts.id', '=', 'users.account_id'); this.orOn('accounts.owner_id', '=', 'users.id'); }); });
knex .select('*') .from('users') .join('accounts', function () { this.on(function () { this.on('accounts.id', '=', 'users.account_id'); this.orOn('accounts.owner_id', '=', 'users.id'); }); });
New dialect for snowflake - quotes and case sensitivity
Help with implementation of new dialect for snowflake
DefaultQueryCompiler
There are several things that snowflake does not support, such as indices....is there any helper to put all columns in json_build_object?
Advice for debugging timeout/connection issues with Kysely
Is it possible to change type of returned value with jsonBuildObject?
'wartosc'
as string
but actually it returns number
. Can't simply change zod reponse schema, cuz kysely types wartosc
in query is as string, and there is type mismatch anyway. (sorry for polish, ubiquitous language with polish domain masters)
```
jsonBuildObject({
id: eb.ref('domyslnaStawkaVatSprzedazy.id'),
nazwa: eb.ref('domyslnaStawkaVatSprzedazy.nazwa'),...Create conditional cte insert query
Is it possible to configure to which types database columns are introspected?
int id
is introspected to Generated<number>
(we would like number type) or decimals
are introspected to Numeric
(we would like just number)How to infer an aggregated column with `filterWhere` clause as nullable?
leftJoin
, then grouping rows by id, and finally using jsonAgg(jsonBuildObject(...))
with a filterWhere
method chained on top of this expression as seen in the demo.
The problem is that the inferred type by kysely is incorrect, because it thinks the json aggregate function will always be an array, however, if there are no matching rows from the other table it will be NULL because of the filter where clause....defineConfig using --environment type issue with seedFolder
Accessing underlying methods on the client
Kysely
class itself, or if it is necessary for me to write my own extension of the class to achieve this