-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Inserting Multiple Rows At Once #638
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
Comments
Could you be more specific or what's to goal that you want to achieve? |
How can I do something like that: INSERT INTO mytable (col1, col2, col3) VALUES
(1, 2, "abc"),
(2, 4, "xyz"),
(3, 5, "aaa"),
(4, 7, "bbb"); |
You could do it with an SQL statement like you've wrote. I've posted a sample SQL-Statement here: #626 Or you could write a loop and do it with the SQLite way from the documentation: for user in usersArray {
try db.run(users.insert(email <- user.email, name <- user.name))
// INSERT INTO "users" ("email", "name") VALUES (UserEmail, UserName)
} I haven't tested this. |
That's just workarounds I already did use plain sql statements, but would be nice to have it supported. |
Well maybe @stephencelis or one of the contributors will comment on this, but I don't see the loop-way as a workaround. I would go that way. |
would like this feature also |
That would be an awesome feature ... I've searched the docs for something similar but had to use an SQL statement at the end |
Is there still a way to insert multiple rows in one go ? |
You can add them in a single transaction:
|
this was merged in #1048 |
I tried to search the docs but found nothing, is it possible to insert multiple rows at once?
The text was updated successfully, but these errors were encountered: