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 }}
Repository navigation
[proposal] Support LOAD DATA LOCAL INFILE for MySQL #2179
I propose to keep the same :copyfrom name and semantics, even though that's technically incorrect for MySQL.
I've looked at the three MySQL drivers listed on https://github.com/golang/go/wiki/SQLDrivers and the other two don't seem to support LOAD DATA [LOCAL] INFILE, though they might support it in the future.
We'd probably want to add a setting where people can indicate which MySQL driver they're using so we can generate the code using the relevant package.
We need to encode the sqlc rows to TSV (or another CSV-like format) that is accepted by LOAD DATA INFILE. I propose to create an external library for that and let the generated code depend on it. (It felt like too much to generate inline.)
We need to configure sqlc which mysql driver is used, because database/sql doesn't natively support LOAD DATA INFILE. I think sql_package is the right place to put that. Passing go-sql-driver/mysql would behave mostly the same as passing database/sql, except that it allows :copyfrom support
Activity
[-]Support LOAD DATA LOCAL INFILE for MySQL[/-][+][proposal] Support LOAD DATA LOCAL INFILE for MySQL[/+]Jille commentedon Apr 4, 2023
Some more thoughts:
We need to encode the sqlc rows to TSV (or another CSV-like format) that is accepted by LOAD DATA INFILE. I propose to create an external library for that and let the generated code depend on it. (It felt like too much to generate inline.)
We need to configure sqlc which mysql driver is used, because database/sql doesn't natively support LOAD DATA INFILE. I think
sql_packageis the right place to put that. Passinggo-sql-driver/mysqlwould behave mostly the same as passingdatabase/sql, except that it allows:copyfromsupportAllow sql_package: "go-sql-driver/mysql"
MySQL LOAD DATA INFILE: First version
Jille commentedon Apr 20, 2023
I have two PRs ready for this, and a documentation branch I'll send later.
#2220
#2219
Jille/sqlc@loaddata2...loaddata3
Allow sql_driver: "github.com/go-sql-driver/mysql"
Allow sql_driver: "github.com/go-sql-driver/mysql"
Allow sql_driver: "github.com/go-sql-driver/mysql"
Allow sql_driver: "github.com/go-sql-driver/mysql"
MySQL LOAD DATA INFILE: First version
Allow sql_driver: "github.com/go-sql-driver/mysql"
MySQL LOAD DATA INFILE: First version
Allow sql_driver: "github.com/go-sql-driver/mysql" (#2219)
MySQL LOAD DATA INFILE: First version
MySQL LOAD DATA INFILE: First version
MySQL LOAD DATA INFILE: First version
Jille commentedon Apr 25, 2023
I need go-sql-driver/mysql to expose the *time.Location to encode correctly.
@SnoozeThis go-sql-driver/mysql#1416 || go-sql-driver/mysql#1419
SnoozeThis commentedon Apr 25, 2023
(https://snoozeth.is/NFrLngXswx4) I will either wait until go-sql-driver/mysql#1416 is closed or until go-sql-driver/mysql#1419 is merged and then add a comment.
MySQL LOAD DATA INFILE: First version
SnoozeThis commentedon Nov 3, 2023
An error occurred while snoozing: not found
Allow sql_driver: "github.com/go-sql-driver/mysql" (sqlc-dev#2219)