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
Which looks to me like the $1 wasn't substituted at all.
Is there a way to do this currently that I'm missing? If not, is this something that you'd want rust-postgres to support, or would it be better as a separate crate, something like activerecord-import?
Thanks!! ❤️
The text was updated successfully, but these errors were encountered:
rust-postgres passes the query string along directly to the postgres backend, which only allows parameters in the place of values, not here where it's looking for a comma-separated list of tuples. You could maybe do something with an array of composite types, but it'd probably be way too complicated to be worth it.
I think an external crate would make sense here, yeah. It'd probably involve generating query strings that look like INSERT INTO categories (category) VALUES ($1), ($2), ($3), ($4), ... for relatively small sets of values, and then switching over to COPY categories (category) FROM STDIN (FORMAT BINARY) using something like https://crates.io/crates/postgres-binary-copy when the value set grows larger.
I am doing a row-by-row insert of spreadsheet data into PostgreSQL and I think the overhead of each individual query is slowing me down (~200 million rows). I "think" it would be much faster if I could build larger queries with many rows of data in them but don't currently see a solution for that in rust.
What I'd like to be able to do is something like this:
And I expected the SQL generated to be:
The code above compiles, but I get a panic on unwrapping:
Which looks to me like the
$1
wasn't substituted at all.Is there a way to do this currently that I'm missing? If not, is this something that you'd want rust-postgres to support, or would it be better as a separate crate, something like activerecord-import?
Thanks!! ❤️
The text was updated successfully, but these errors were encountered: