Open markddrake opened 3 months ago
Sure I've missed something simple but can't see what.
Hi @markddrake, based on related issues, what happens if you return the content from createReadStream
?
- infileStreamFactory : (path) => {fs.createReadStream(path)}
+ infileStreamFactory : (path) => fs.createReadStream(path)
That fixed it - Thank you. I've been able to run my testcase, and my real-world regression tests with that change made.
It was blindly obvious once you pointed that out. That said maybe it would be better if the code checked that it has a valid stream before starting to attach events to it it, and throw a more meaningful error if what it gets is not a stream - minor enhancement I know.
I think there's an enhancement request for a better error message here.
@markddrake, would you like to contribute? The message could be based on how mysql handles this behavior.
I don't think (haven't looked) that mysql has to deal with this particular issue. AFAIK The whole inputStreamFactory() concept is specific to mysql2.
Migrating from mysql to mysql2.
Attempting to use INFILE LOCAL to load a file into a staging table
Code
Results in
Environment
MySQL 9.0.1 from official docker container.