Skip to content

Brighthouse + LOAD DATA LOCAL INFILE + Reader = fail #355

Closed
@mrsinham

Description

@mrsinham

Hello,

I'm getting some troubles while using a reader on a LOAD DATA LOCAL INFILE on Brighthouse. The issue is that instead of returning just table name, brighthouse is giving back an absolute path to the dbfile.

Examples are more comprehensive :

When I do :

mysql.RegisterReaderHandler(
            "Yeapa",
            func() io.Reader {
                var csvReader io.Reader // Some Reader that returns CSV data
                csvReader = file
                return csvReader
            },
        )

_, err = conn.Exec("LOAD DATA LOCAL INFILE 'Reader::Yeapa' INTO TABLE MY_TABLE FIELDS TERMINATED BY ',' ENCLOSED BY '\"'")
if nil != err {
    return err
}

I have this error :

Local File '/data/infobright-data/[databasename]/Reader::Yeapa' is not registered. Use the DSN parameter 'allowAllFiles=true

It' because in the method handleInFileRequest() Brighthouse gives back the path to the db file in the parameter name :

/data/infobright-data/[database]/Reader::Yeapa

This line in infile.go becomes false :

if strings.HasPrefix(name, "Reader::") { // io.Reader

And the driver thinks it's a file. The file is not found and the code fails.

Thanks !

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions