New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inserting multiple rows at once #75
Comments
Hello @atjeff, This may be able to be improved within For example, the SQL syntax for inserting multiple records usually looks something like this: INSERT INTO test (id)
VALUES (?), (?), (?), ...; Depending on how many rows you are planning to add at one time, which looks a bit different than the examples you shared above. I'm not sure if it would work, but if you know how many rows you are going to pass in, you could make the placeholder section of your query dynamic, and include as as many placeholders as rows you are planning to insert, and then pass in your values and that may work for this simplified table example you had shared:
Another option you may be interested in exploring would be the kysely-planetscale dialect for kysely, which provides additional functionality on top of the basic features |
Thank you |
A little feedback if someone is looking for an answer to this. I am creating queries with 35M characters which are inserting 5k rows at a time and it works perfectly fine. Such a query takes ~20s to execute in my case. |
In case anybody else is looking at this later, you do indeed need to flatten the values to a single array (so using the example above, |
Hey guys, not sure if I'm missing something, but does this client not support inserting more than one row at a time? Having trouble finding any mention in planetscale docs, readme, and the code in this library
I've also tried:
etc
The text was updated successfully, but these errors were encountered: