Welcome to Geeklog Thursday, August 16 2018 @ 11:49 pm EDT

Geeklog Forums

Conversion from CSV to sql


antonio

Anonymous
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

Antonio

Anonymous
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

Status: offline

suprsidr

Forum User
Full Member
Registered: 29/12/04
Posts: 555
Location:Champaign, Illinois
Google search reveals http://www.codewalkers.com/c/a/Database-Code/CSV-to-SQL-convertor/

-s
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com

Antonio

Anonymous
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

Status: offline

suprsidr

Forum User
Full Member
Registered: 29/12/04
Posts: 555
Location:Champaign, Illinois
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


FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com

Status: offline

Laugh

Site Admin
Admin
Registered: 27/09/05
Posts: 1299
Quote by: 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



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.
One of the Geeklog Core Developers.

Louise

Anonymous
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.

All times are EDT. The time is now 11:49 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content