-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
Line 104 in ba48112
| .bind(...compiledQuery.parameters) |
Context
For a few hours I am trying to debug a non trivial problem
D1_ERROR: too many SQL variables
I found that generation of kysely-d1 is using the rest operator .bind(...data) therefore from
array of objects i get one single array which is flat.
From this point D1 will fail because I have suddenly 100+ params
To reproduce
create a big table
export interface items {
a: string;
b: string;
c: string;
d: string;
created_at: Generated<string | null>;
e: string;
f: Generated<number | null>;
id: string;
g: string | null;
h: string;
i: string | null;
j: string;
k: string;
l: string;
m: string;
n: string;
}try to do a insert with 10 items
Which produces sql like this
insert into "items" ("a", "b", "c", "d", "e", "f", "id", "g", "h", "i", "j", "k", "l", "m", "n") values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)and params will be
Array(135) [ ]
To fix
Most possible adapt https://developers.cloudflare.com/d1/platform/client-api/#batch-statements ?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels