Posted on: 04/18/10 05:46pm
By: Anonymous (antonio)
Hi
sometime ago I exported the full database of my geeklog website into a csv file
now i'd need to import it again into a new geeklog database, but phpmyadmin only accepts
sql files as input.
How can I reconvert the original db to sql?
any help would be appreciated
Cheers
Antonio
Re: Conversion from CSV to sql
Posted on: 04/24/10 06:40am
By: Anonymous (Antonio)
Hi
I just would like to add, that I can't, right now do a full back-up of my web
because it is down, and the actual host provider has forbidden execs() on the data base for (apparently) security reasons.
So it would be important for me to rebuild the DB from what I have, which is an older CSV file.
Any help would be appreciated
Cheers
Antonio
Re: Conversion from CSV to sql
Posted on: 04/24/10 08:55pm
By: suprsidr
Re: Conversion from CSV to sql
Posted on: 04/25/10 12:11pm
By: Anonymous (Antonio)
Hi
thanks, but the cuestion is that the geeklog DB has many different tables and the data in CVS files are "flat" data, without the table reference information.
So how do I feed the correct data to the correct table? How can I tell the converter where one table data starts and finishes?
all the best
Antonio
Re: Conversion from CSV to sql
Posted on: 04/26/10 08:06am
By: suprsidr
I just did a test export to cvs on a small development gl site.
Exporting one table at a time would have been the preferred method for cvs.
After adjusting the php on the above tool so it would work w/ php5 it looks promising for creation of sql inserts.
But you'll have to separate and name the tables yourself which certainly won't be easy.(Using an editor that knows what the line breaks are like Eclipse makes it a bit easier)
As I said - separating the tables at export would have made things easier.
You'll also likely need the same version of gl database for insert as well. Newer gl has extra columns for many key tables.
So to re-cap:
- Install the same old version of geeklog so the db has the same table structure.
- Manually separate the tables in your cvs file
- Use the cvs->sql tool to convert to inserts
- Perform the inserts
- Make sure the old version of gl is operational w/ inserted data
- Re-export to SQL
- import/update to GL1.6.1
Whew!
Worth it?
-s
Re: Conversion from CSV to sql
Posted on: 04/26/10 12:34pm
By: Laugh
Quote by: antonioHi
sometime ago I exported the full database of my geeklog website into a csv file
now i'd need to import it again into a new geeklog database, but phpmyadmin only accepts
sql files as input.
How can I reconvert the original db to sql?
any help would be appreciated
Cheers
Antonio
Actually phpMyAdmin does accept csv file to import data but not for the entire database just for individual tables. Click on a table and then click the import tab to see all the options avaialble. So if your csv file contains data for all the tables you will have to manually break up the one file into a file for each table.
Re: Conversion from CSV to sql
Posted on: 04/25/18 11:51am
By: Anonymous (Louise)
The quickest way is to use a conversion tool like SQLizer.io.
It’ll convert xlsx, xls, or csv to SQL in seconds and give you properly formatted table and INSERT data. It’ll literally save you hours over manually doing it or writing a script.
You can also convert XML and JSON files with SQLizer.