Skip to content

[proposal] Support LOAD DATA LOCAL INFILE for MySQL #2179

Closed
@Jille

Description

@Jille

https://github.com/go-sql-driver/mysql#load-data-local-infile-support supports LOAD DATA LOCAL INFILE with an io.Reader.

We could implement the :copyfrom query annotation to use LOAD DATA LOCAL INFILE when using go-sql-driver. The generated code would call https://pkg.go.dev/github.com/go-sql-driver/mysql#RegisterReaderHandler with a new reader for this call (and deregister it afterwards).

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions