[Nelug] MySQL and Importing

Richard Mortimer richm at oldelvet.org.uk
Fri Jan 27 13:37:38 UTC 2006


I haven't really played with load data. I normally work with output like
that produced by mysqldump but here's a few ideas

-----Original Message-----
From: nelug-bounces at mailman.lug.org.uk
[mailto:nelug-bounces at mailman.lug.org.uk] On Behalf Of Dougie Nisbet
Sent: 27 January 2006 10:16
To: North East Linux User Group mailing list
Subject: [Nelug] MySQL and Importing

 
 The problem is that my exported data is not neat. The fields are
multi-lined, and I can't figure out how to get MySQL to identify records and
fields. 
 

How about turning all of the newlines in the recipe to \n that means that
each recipe is on one line with the data quoted.
 
Another option is to try manually adding some data to mysql and dumping it.
Then see what mysql dumps and make your output copy that. I really think
that a bit of pre-processing is going to be necessary.

 
For instance, here's the first record as exported from HandBase. Exported as
CSV, with fields enclosed in quotation marks. As you can see, the fields are
multilined.



recipe,srvs,source,sourcenotes,ingredients,method,time,cooktime,Notes,SC
"Quick chicken korma
prep=15m
cook=20m (plus rice)
SC=?
serves=4","4","Rosemary Conley Low Fat Cookbook Two



 >  Finally, I'm normally a CLI fan and avoid GUIs. But if I'm going to be
typing in a load of recipes I thought I'd investigate the   GUI front-ends
to mysql. Does anyone use any or have any recommendations? I'm running
Debian.

Two great tools that I sometimes use are
 
 apt-get install mysql-admin mysql-query-browser 
 
there's always phpmyadmin too.
 
Have fun
 
Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.lug.org.uk/pipermail/durham/attachments/20060127/cc0ae794/attachment.htm 


More information about the Nelug mailing list