MySQLDumper-Board Forum Index Follow me on Twitter

Portal  •   Forum  •  Downloads  •  Profile  •  Search   •  Register  •  Log in to check your private messages  •  Log in  •  


 Importing a partial table - "Empty table before"?

Post new topicReply to topic
Author Message
zegron
knows MySQLDumper
knows MySQLDumper





Joined: 04 Jul 2011
Posts: 6


blank.gif

PostPosted: 2011-07-04, 21:42    Importing a partial table - "Empty table before"? Reply with quoteBack to top

I have a fairly large table (26,000 entries) that I've done some bulk updating to about 50% of it, prices changes, and I need to know if I can import just the changed portion or do I need to import the entire thing at once?

I ask this because I tried to import just the data that was changed and it told me that there were duplicate entries, I understand why this is, but I'm hesitant to use the 'Empty table before' option because I don't know if it will erase EVERYTHING in the table or if it will just erase the portion of old data that I'm replacing and then add the updated data to the table.

Hopefully this is clear.

Thanks,
Matt

OfflineView user's profileSend private messageSend e-mail    
Anzeigen











Posted:    Anzeigen Back to top


    
DSB
Developer
Developer




Age: 41
Joined: 30 Apr 2004
Posts: 16070
Location: Reichenberg bei Würzburg


germany.gif

PostPosted: 2011-07-04, 22:06    (No subject) Reply with quoteBack to top

How did you do the backup?
MySQLDumper doesn't offer to do partial exports of a table.

Btw: don't use the "empty tables" option. It drops all tables of the target database. It is meant to be used when you restore backups that don't have a "DROP TABLE"-statement.

MySQLDumper always adds a DROP TABLE-statement in its backups, so that's why I am asking how you created the backup you try to import.

_________________
Gruß / Greetings, DSB

Teigwaren heißen Teigwaren, weil sie Teig waren.
Diejenigen, die lautstark darüber diskutieren, warum es nicht geht, mögen bitte jene nicht stören, die es gerade tun.

OfflineView user's profileSend private messageSend e-mailVisit poster's website    
zegron
knows MySQLDumper
knows MySQLDumper





Joined: 04 Jul 2011
Posts: 6


blank.gif

PostPosted: 2011-07-04, 23:53    (No subject) Reply with quoteBack to top

I used the export tool from inside the SQLBrowser.
OfflineView user's profileSend private messageSend e-mail    
DSB
Developer
Developer




Age: 41
Joined: 30 Apr 2004
Posts: 16070
Location: Reichenberg bei Würzburg


germany.gif

PostPosted: 2011-07-05, 00:05    (No subject) Reply with quoteBack to top

This also doesn't offer a partial export of the data of a table. So I wonder what you did.

But to answer this question:

Quote:
I need to know if I can import just the changed portion or do I need to import the entire thing at once?


In the sense of a consistant backup always export complete data sets.
You should use the backup button. The export tools are there to export data to let you import them into other applications like e.g. Excel.
They are not meant to export data to csv, change it and then re-import it to the database (you could change the records by editing the records instead).

These functions are not able to handle big amounts of data and they can't avoid timeouts like the backup-/restore-Methods can.

_________________
Gruß / Greetings, DSB

Teigwaren heißen Teigwaren, weil sie Teig waren.
Diejenigen, die lautstark darüber diskutieren, warum es nicht geht, mögen bitte jene nicht stören, die es gerade tun.


Last edited by DSB on 2011-07-05, 00:07; edited 1 time in total

OfflineView user's profileSend private messageSend e-mailVisit poster's website    
Jens_K
Moderator
Moderator




Age: 37
Joined: 04 Sep 2007
Posts: 1710
Location: Nähe Bielefeld


germany.gif

PostPosted: 2011-07-05, 00:06    (No subject) Reply with quoteBack to top

Why did you do that?

If you want to alter 50% of the data in a table, make a dump of that specific table (choose "select table" when creating a backup), download that file, unpack it, open it with a text-editor (MS Word isn't one!), make the changes you want to make, save it, upload it into work/backup folder and restore it.

That will completely delete your old table with all data in it and restore the data from the file you just edited.

_________________
It's like math-camp all over again ... not ... that i've ever been to math-camp!
mein Blog

OfflineView user's profileSend private messageVisit poster's website    
zegron
knows MySQLDumper
knows MySQLDumper





Joined: 04 Jul 2011
Posts: 6


blank.gif

PostPosted: 2011-07-05, 00:09    (No subject) Reply with quoteBack to top

Sorry if I wasn't clear, I exported the whole table using the export tool, then edited it in my spreadsheet program. I didn't realize that the backup tool would let me do just a table by itself. I thought it was an all or nothing sort of thing. I've gone back and looked again and I see the 'select table' option now.

I've gone and used the backup tool to export the proper template, i will redo my edits. Once thats done and ready do i upload it back to my server in the folder with the rest of the backups and restore from there?

Matt

OfflineView user's profileSend private messageSend e-mail    
DSB
Developer
Developer




Age: 41
Joined: 30 Apr 2004
Posts: 16070
Location: Reichenberg bei Würzburg


germany.gif

PostPosted: 2011-07-05, 00:14    (No subject) Reply with quoteBack to top

So this issue is solved.
Have fun using MySQLDumper. Wink

_________________
Gruß / Greetings, DSB

Teigwaren heißen Teigwaren, weil sie Teig waren.
Diejenigen, die lautstark darüber diskutieren, warum es nicht geht, mögen bitte jene nicht stören, die es gerade tun.

OfflineView user's profileSend private messageSend e-mailVisit poster's website    
DSB
Developer
Developer




Age: 41
Joined: 30 Apr 2004
Posts: 16070
Location: Reichenberg bei Würzburg


germany.gif

PostPosted: 2011-07-05, 00:16    (No subject) Reply with quoteBack to top

« zegron » wrote:
Once thats done and ready do i upload it back to my server in the folder with the rest of the backups and restore from there?

Yes.

_________________
Gruß / Greetings, DSB

Teigwaren heißen Teigwaren, weil sie Teig waren.
Diejenigen, die lautstark darüber diskutieren, warum es nicht geht, mögen bitte jene nicht stören, die es gerade tun.

OfflineView user's profileSend private messageSend e-mailVisit poster's website    
DSB
Developer
Developer




Age: 41
Joined: 30 Apr 2004
Posts: 16070
Location: Reichenberg bei Würzburg


germany.gif

PostPosted: 2011-07-05, 00:22    (No subject) Reply with quoteBack to top

But before you import your edited file, make a new backup of the table in question.
This way you can restore this file in case you broke the file with your edits and restoring doesn't work.

When editing the sql-file, make sure you won't change the encoding of the file!
I suggest you use notepad++ to edit the file.

_________________
Gruß / Greetings, DSB

Teigwaren heißen Teigwaren, weil sie Teig waren.
Diejenigen, die lautstark darüber diskutieren, warum es nicht geht, mögen bitte jene nicht stören, die es gerade tun.

OfflineView user's profileSend private messageSend e-mailVisit poster's website    
zegron
knows MySQLDumper
knows MySQLDumper





Joined: 04 Jul 2011
Posts: 6


blank.gif

PostPosted: 2011-07-05, 00:25    (No subject) Reply with quoteBack to top

Yea, i noticed the encoding issue, notepad++ will work, just makes it a bit longer. I have 26,000 prices to alter. but since I'm doing in bulk i can use find/replace, just will take longer than using excel. :-) but I will get it done. I'm too stubborn to let it go. :-)
OfflineView user's profileSend private messageSend e-mail    
DSB
Developer
Developer




Age: 41
Joined: 30 Apr 2004
Posts: 16070
Location: Reichenberg bei Würzburg


germany.gif

PostPosted: 2011-07-05, 00:33    (No subject) Reply with quoteBack to top

You can also do bulk replaces using SQL in the SQLBrowser.
E.g.:
UPDATE `myTable` SET `row`= 'new_value' WHERE `row` = 'oldValue';


Maybe test it on a local server using e.g. Xampp.
This is the way I do things like this.

_________________
Gruß / Greetings, DSB

Teigwaren heißen Teigwaren, weil sie Teig waren.
Diejenigen, die lautstark darüber diskutieren, warum es nicht geht, mögen bitte jene nicht stören, die es gerade tun.

OfflineView user's profileSend private messageSend e-mailVisit poster's website    
zegron
knows MySQLDumper
knows MySQLDumper





Joined: 04 Jul 2011
Posts: 6


blank.gif

PostPosted: 2011-07-05, 01:11    (No subject) Reply with quoteBack to top

It ended up being much faster to export it using the export tool with " and ; as delimiters and making sure that Openoffice Calc was set to UTF8, sorting the columns, editing the prices, then importing it in a few batches using the import tool. There was no reasonable way to edit 26,000 lines the way i needed to in notepad ++ since it can't sort and there is huge range of prices. :-)
OfflineView user's profileSend private messageSend e-mail    
DSB
Developer
Developer




Age: 41
Joined: 30 Apr 2004
Posts: 16070
Location: Reichenberg bei Würzburg


germany.gif

PostPosted: 2011-07-05, 01:18    (No subject) Reply with quoteBack to top

Ok, this time this way won. Wink

But if the number of records grows too big, so that the csv file can't be imported because it exceeds the max execution time of PHP you will remember my words. So I hope you wont have to repeat that again.

_________________
Gruß / Greetings, DSB

Teigwaren heißen Teigwaren, weil sie Teig waren.
Diejenigen, die lautstark darüber diskutieren, warum es nicht geht, mögen bitte jene nicht stören, die es gerade tun.

OfflineView user's profileSend private messageSend e-mailVisit poster's website    
zegron
knows MySQLDumper
knows MySQLDumper





Joined: 04 Jul 2011
Posts: 6


blank.gif

PostPosted: 2011-07-05, 01:24    (No subject) Reply with quoteBack to top

I just copy and pasted into the text box. :-) I hope I don't have to change those prices in bulk again either. :-) even with a spreadsheet it still took me 15 min to change all 26,000 records. :-)
OfflineView user's profileSend private messageSend e-mail    
Display posts from previous:      
Post new topicReply to topic


 Jump to:   


Show permissions
Similar topics
Topic Author Forum Replies Posted
No new posts Unknown table-Fehler... hjortron Fehler / Probleme 1 2012-05-17, 16:42 View latest post
No new posts [solved] Restore:Can't create table '... rob40 Gelöst/Erledigt 6 2012-05-13, 20:41 View latest post
No new posts Auswahl "Alle Datenbanken" ... Massa MySQLDumper 1.24 8 2012-05-02, 09:52 View latest post
No new posts Variable "$pcd_version" wil... ivan Fehler / Probleme 3 2012-03-09, 19:27 View latest post
No new posts "Delete Tables Before Restoring&... HillTopsGM Errors and questions 2 2012-02-21, 19:29 View latest post

 
CrackerTracker © 2004 - 2012 CBACK.de

Powered by Orion based on phpBB © 2001, 2002 phpBB Group
CBACK Orion Style based on FI Theme
All times are GMT + 2 Hours

phpBB SEO