You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 10, 2020. It is now read-only.
I'm trying to bacth insert a large number of data to the sql server, but I cant figure out a good way to do this with this driver. Do you have any pointers on how to go forward with that or where to look for information on how to accomplish this?
The text was updated successfully, but these errors were encountered:
I realized that there is no way to do this besides constructing a query yourself and insert batches of 1000 entries and repeat until finished. Maybe this issue should be converted to a feature suggestion?
I'll found a pretty nice way of batch inserting which is not limited to 1000 so I'll leave it here for future reference in case it's useful for implementing a batch insert:
fnbatch_insert(){letmut values:String = (0..10_000).map(|i| format!("({},{}),", i, i *100)).collect();// Remove last comma
values.pop();let update = format!("INSERT INTO sometable(id, price) SELECT id, price FROM (VALUES {})sub(id, price)", values);let fut = SqlConnection::connect(CONNSTR).and_then(|conn| {
conn.simple_exec(update)});block_on_all(fut).unwrap();}
I'm trying to bacth insert a large number of data to the sql server, but I cant figure out a good way to do this with this driver. Do you have any pointers on how to go forward with that or where to look for information on how to accomplish this?
The text was updated successfully, but these errors were encountered: