KyselyK
Kysely3y ago
7 replies
jpayne

`update set from`

Accroding to @koskimas, kysely supports the
update set from
sql syntax. So far, I've been unable to figure out how (in lieu of dropping down to raw sql).

We are planning to craft many of our update statements as batch operations in our repository layer, so this pattern will be used heavily.

Here's some example sql to make it clear (hopefully) what I'm trying to do

update test as t set
    column_a = c.column_a
from (values
    ('123', 1),
    ('345', 2)  
) as c(column_b, column_a) 
where c.column_b = t.column_b;


Reference: https://github.com/kysely-org/kysely/issues/677#issuecomment-1707741394
GitHub
I'm searching for a Kysley query to perform a bulk update of my table data.
Is there a Kysely workaround for bulk updates in a single table? · ...
Was this page helpful?