i have one column that have values with 4000+ characters and when i do the import the value is truncated and i lose a great deal of the string. I did the import via Sequel Pro and via terminal with:
int total; // Sum of the two rolls.
do {
int dice1; // First Dice.
int dice2; // Second Dice.
dice1 = (int)(Math.random()*6) + 1;
dice2 = (int)(Math.random()*6) + 1;
total = dice1 + dice2;
System.out.println("Your first roll is " + dice1);
System.out.println("Your second roll is " + dice2);
System.out.println("Your complete roll is " + total);
} while (total != 7 && total != 12);
here is the table schema:
mysqlimport --ignore-lines=1 --fields-terminated-by=, --local -u root -p bustracker routes.dat
and a sample of value from the column:
CREATE TABLE `routes` (
`id_rota` varchar(255) NOT NULL,
`nome` varchar(255) DEFAULT NULL,
`descricao` varchar(255) DEFAULT NULL,
`painel` varchar(255) DEFAULT NULL,
`PONTOS` varchar(255) DEFAULT NULL,
`via` longtext,
PRIMARY KEY (`id_rota`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
Anyone knows how to import a .csv without losing data?
答案 0 :(得分:0)
Make sure to add date_time,StationName,air_temp,dewpoint,humidity,windspeed,windchill,pressure
2014-07-01,X,11,8.74811,86,0,11,1017.22
2014-07-02,X,16.2222,12.7651,80,1,16.2222,1019.02
2014-07-03,X,21.3889,13.039,59,0,21.3889,1020.37
2014-07-04,X,21.4444,12.8294,58,3,21.4444,1020.74
2014-07-05,X,21.4444,12.8294,58,3,21.33,1020.71
2014-07-06,X,21.4444,12.8294,58,9,21.4444,1020.74
2014-07-07,X,21.3889,12.5119,57,9,21.3889,1020.74
2014-07-08,X,21.3889,12.2423,56,9,21.3889,1020.74
2014-07-09,X,21.3889,12.2423,56,11,21.3889,1020.74
2014-07-01,Y,13.7,9.4,75,1,13.9,1020.3
2014-07-02,Y,13.7,9.4,75,2,13.9,1020.3
2014-07-03,Y,13.7,9.4,76,2,13.9,1020.3
2014-07-04,Y,13.6,9.4,76,3,13.9,1020.4
2014-07-05,Y,13.6,9.4,76,3,13.9,1020.3
2014-07-06,Y,13.6,9.4,76,2,13.3,1020.3
2014-07-07,Y,13.6,9.4,76,2,13.3,1020.4
2014-07-08,Y,13.5,9.4,76,1,13.3,1020.4
2014-07-09,Y,13.5,9.4,76,2,13.3,1020.4
2014-07-01,Z,13.2,10,82,0,13.3,1016.3
2014-07-02,Z,13.2,10,82,0,13.3,1016.3
2014-07-03,Z,13.1,10,82,0,13.3,1016.3
2014-07-04,Z,13.1,10,82,0,13.3,1016.3
2014-07-05,Z,13.1,10,82,0,13.3,1016.3
2014-07-06,Z,13.1,10,82,0,13.3,1016.3
2014-07-07,Z,13.1,10,82,0,13.3,1016.3
2014-07-08,Z,13,10,82,0,12.8,1016.3
2014-07-09,Z,12.9,10,82,0,12.8,1016.2
and --fields-optionally-enclosed-by='\"'
to ensure you capture the full data set.
Additionally, add --lines-terminated-by='\n'
to diagnose potential problems, and --verbose
to ensure your getting the latest imported data.
The full import should read;
--replace