mysql Dumps zusammenführen

Seite 1 von 1 - Forum: Coding Stuff auf overclockers.at

URL: https://www.overclockers.at/coding-stuff/mysql-dumps-zusammenfhren_239008/page_1 - zur Vollversion wechseln!


CyQuest schrieb am 15.05.2014 um 18:39

Hallo,

habe folgendes Problem.

Hab hier 5 Mysql Dumps von der gleichen Datenbank nur der Inhalt ist immer ein Monat.
Also Jänner, Feber, März ....

So nun würde ich gerne die 5 zusammenspielen nur leider bekomme ich ein Problem mit dem primary key. Der fängt bei jedem Dump wieder bei 1 an.

z.b.

Code:
INSERT INTO `me_data` (`id`, `idref`, `uri`, `strValue`, `unit`, `decPlaces`, `scaleFactor`, `advTextOffset`, `data`, `time`, `year`, `day`, `month`, `week`, `hour`, `minute`) VALUES 	(1, 1, '40/10021/0/0/12000', 'Bereit', '', 0, 1, 2000, 'data...', 1396443666, 2014, 2, 4, 14, 15, 1),

Wer eine idee?


murcielago schrieb am 15.05.2014 um 18:44

einfach ohne id einfügen und die ID auf autovalue stellen...


CyQuest schrieb am 15.05.2014 um 18:53

Ok wie bekomme ich das aus dem Dumpfile raus hat ~300k einträge jede File.


kleinerChemiker schrieb am 16.05.2014 um 10:10

Möglichkeit 1: guter Texteditor und mit Regex entfernen
Möglichkeit 2: ohne id exportieren


COLOSSUS schrieb am 16.05.2014 um 10:27

Code:
jt@d257:~ $ cat sample 
INSERT INTO `me_data` (`id`, `idref`, `uri`, `strValue`, `unit`, `decPlaces`, `scaleFactor`, `advTextOffset`, `data`, `time`, `year`, `day`, `month`, `week`, `hour`, `minute`) VALUES	(1, 1, '40/10021/0/0/12000', 'Bereit', '', 0, 1, 2000, 'data...', 1396443666, 2014, 2, 4, 14, 15, 1),
INSERT INTO `me_data` (`id`, `idref`, `uri`, `strValue`, `unit`, `decPlaces`, `scaleFactor`, `advTextOffset`, `data`, `time`, `year`, `day`, `month`, `week`, `hour`, `minute`) VALUES	(2, 1, '50/10021/0/0/12000', 'Bereit', '', 0, 1, 2000, 'data...', 1396443666, 2014, 2, 4, 14, 15, 2),

jt@d257:~ $ while read -r -a line; do line[3]='('; line[20]='('; echo "${line[@]}"; done < sample 
INSERT INTO `me_data` ( `idref`, `uri`, `strValue`, `unit`, `decPlaces`, `scaleFactor`, `advTextOffset`, `data`, `time`, `year`, `day`, `month`, `week`, `hour`, `minute`) VALUES ( 1, '40/10021/0/0/12000', 'Bereit', '', 0, 1, 2000, 'data...', 1396443666, 2014, 2, 4, 14, 15, 1),
INSERT INTO `me_data` ( `idref`, `uri`, `strValue`, `unit`, `decPlaces`, `scaleFactor`, `advTextOffset`, `data`, `time`, `year`, `day`, `month`, `week`, `hour`, `minute`) VALUES ( 1, '50/10021/0/0/12000', 'Bereit', '', 0, 1, 2000, 'data...', 1396443666, 2014, 2, 4, 14, 15, 2),


CyQuest schrieb am 17.05.2014 um 12:52

Danke




overclockers.at v4.thecommunity
© all rights reserved by overclockers.at 2000-2025