Permalink
Browse files

import-account: show warnings when importing data

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
  • Loading branch information...
1 parent ce93a9a commit caa17d0498d2e70bf38ddc7d4585f7d7cc2d840b @pierre pierre committed Nov 23, 2016
Showing with 1 addition and 1 deletion.
  1. +1 −1 bin/import-account
View
@@ -90,7 +90,7 @@ function export_data() {
function import_data() {
local filename=$1
local columns_names=$2
- mysqlimport --local --ignore-lines=1 --fields-terminated-by=, --fields-enclosed-by=\" --columns=$columns_names --verbose -u$USERNAME -p$PASSWORD $DATABASE $TMP_DIR/$filename
+ mysql --local-infile --execute="LOAD DATA LOCAL INFILE '$TMP_DIR/$filename' INTO TABLE $filename FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' IGNORE 1 LINES ($columns_names); SHOW WARNINGS" -u$USERNAME -p$PASSWORD $DATABASE
}
function sanitize_and_import() {

2 comments on commit caa17d0

@sbrossie
Member

Is that the correct way to import mysql data? (using mysql --local-infile --execute instead of mysqlimport --local...? Does the new command reflect exactly what we had before (+ new warnings) ?

@pierre
Member
pierre commented on caa17d0 Dec 5, 2016 edited

Yup, should be equivalent (mysqlimport is just a wrapper, with less options and more quirks though, such as swallowing warnings).

Please sign in to comment.