mariadb - "ERROR 2013 (HY000): Lost connection to MySQL server during query" while loading data -
i getting error when try load data mysql (mariadb actually) table using load data
command:
load data local infile '/tmp/my_data.tsv' table my_schema.my_table fields terminated '\t' optionally enclosed '"' escaped '\\' lines terminated '\n';
for reason, mysql gives obscure error message when data loading breaks foreign key constraint (described in more detail here).
i managed correct error message executing load data
command directly command line. i.e. running:
mysql -u username -p --local-infile --execute= \ "load data local infile '/tmp/my_data.tsv' table my_schema.my_table \ fields terminated '\t' optionally enclosed '\"' escaped '\\\\';"
gave error message:
cannot add or update child row: foreign key constraint fails (`my_schema`.`my_table`, constraint `other_table` foreign key (`id`) references `other_table` (`id`))
after removing rows violated foreign key constraint, able import data.
Comments
Post a Comment