Skip to content

MySQL :copyfrom is not working #2690

Closed
Closed
@p1ass

Description

@p1ass

Version

1.20.0

What happened?

#2545 introduced a :copyfrom feature for MySQL database thanks to @kyleconroy .
However, it is not woking well.

I think the cause of problem is parseDriver function never returns SQLDriverGoSQLDriverMySQL.
https://github.com/sqlc-dev/sqlc/blob/faa1c9d156272eea4d33a31de2ab94951ba6af58/internal/codegen/golang/driver.go#L11C1-L35

Relevant log output

sqlc generate failed.
# package db
error generating code: :copyfrom is only supported by pgx and github.com/go-sql-driver/mysql


### Database schema

```sql
CREATE TABLE authors (
  id   bigint PRIMARY KEY,
  name text      NOT NULL,
  bio  text
);

SQL queries

-- name: BulkInsertAuthors :copyfrom
INSERT INTO authors (id, name, bio) VALUES (?, ?, ?);

Configuration

{
  "version": "1",
  "packages": [
    {
      "path": "db",
      "engine": "mysql",
      "schema": "query.sql",
      "queries": "query.sql"
    }
  ]
}

Playground URL

https://play.sqlc.dev/p/ffd4ea54087e3ade2e02ae5ea9c9d76f00a9f34d0f649544c8ac716a0c1cfed0

What operating system are you using?

macOS

What database engines are you using?

MySQL

What type of code are you generating?

Go

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageNew issues that hasn't been reviewed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions