generating raw sql?
.compile()
method instead of executing.
For more info, check out the link @53ny posted....Conditionally updating fields
UPDATE table SET field = IF(condition, trueValue, falseValue) WHERE someCondition;
, i can't exactly seem to find that in the docs
Driver used: MySQL...How to cast to date. eg : `DATE(created_at)`
transaction takes too long
Syntax error when empty array is passed to a WHERE filter (request for more readable errors)
someQuery.where("x", "in", xs)
, if xs
is empty, then the error will be something like error: syntax error at or near ")"
. Given that in complex queries there can be multiple places that could cause such an issue, debugging it is sometimes painful.
I understand that it's SQL that is throwing the error and empty arrays are not possible, but would it be feasible to do a runtime check by the lib and throw a more readable error in case that happens? Or would this be against the philsophy of Kysely or too much overhead?
Also, I think a fallback of 1=0
might make even more sense, since that should be the logical output of the query with an empty array....Derived tables for Postgres
Complex Query Builder from dynamic input - Typescript issue
conditionBuilder
might return undefined
and .where
expects something....How to add table/column comments when creating tables?
modifyEnd
where possible to add comments with sql
template tag....Need help improving a custom helper
ExpressionBuilder
callback thingy anywhere if it did. We could just use free functions and they'd somehow catch the context through generics in the return value.
another option is month(eb)('created_at')
....jsonArrayFrom with `as` not being typed
How to use multiple schema definitions ( e.g. <catalog>.<schema>.<table> )
Using raw SQL with `or` where
orWhere
clause using it. Here is a simple example of what I am trying to achieve.
```ts
const result = await db
.selectFrom('users')...eb.or
expects a list of Expression<SqlBool>
where SqlBool
is boolean | 0 | 1
Custom Plugin to transform Alias.* to "Alias.Column1", "Alias.Column2", etc.
can kysely be extended with custom types within the database
newbie need help with json_build_object
JSON_BUILD_OBJECT('id', unit.id, 'name', unit.name) AS unit
JSON_BUILD_OBJECT('id', unit.id, 'name', unit.name) AS unit
unit
object because you're using left join. The types are correct. If you are sure there's a unit
for each sku
then use innerJoin
instead....Solved: Exporting query builder classes
building kysely makes the package size very large
bun build --minify --outfile
, i get kysely to be 340.40kB whilst drizzle is 55.35kB, meanwhile the functional code besides the database is identicalKysely setup in monolith API
Is it possible to get the total count while fetching rows in a single query?
Separating results of join into objects of each type