-
Notifications
You must be signed in to change notification settings - Fork 350
Description
I'm using MySqlBulkCopy to load data from a data reader into a MariaDb 10.4 database.
I'm using EF core and Pomelo. Code first way to create the database.
It doesn't work if the column order of the data reader doesn't match the database column order.
The EF migration creates the db tables with some ordering of the columns.
The issue occurs when I try to use MySqlBulkCopy and I pass a data reader with different order of the columns. I checked the sql query - the LOAD DATA statement orders the columns as they are in the database, but when the data is sent to the server, the column are written as they are in the data reader. So I got an error that string value cannot be inserted into a numerical column.
The data reader is a FastMember ObjectReader. If I change the columns order of the object reader to match the database order, MySqlBulkCopy is working as exepcted.