-
|
I have a bunch of How can I insert this without loading the complete file into memory? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
There's no way to stream the value of a single The solution is to send one SQL statement at a time. There is a parser designed to split statements internal to one of my other projects. https://pkg.go.dev/github.com/jackc/tern/v2@v2.3.2/migrate/internal/sqlsplit However, it only works on |
Beta Was this translation helpful? Give feedback.
There's no way to stream the value of a single
conn.Execin pgx / pgconn. And if these files are large enough to cause a problem, then streaming the files probably wouldn't be a good solution as PostgreSQL will be buffering the entire file on it's side.The solution is to send one SQL statement at a time. There is a parser designed to split statements internal to one of my other projects. https://pkg.go.dev/github.com/jackc/tern/v2@v2.3.2/migrate/internal/sqlsplit However, it only works on
stringinputs where you would need it to work on anio.Reader. But perhaps it can be a starting place for you.