[Eug-lug] Importing a .csv file into MySql
Ben Barrett
stircrazyben at gmail.com
Wed Aug 22 14:51:33 PDT 2007
Well what I was trying to say, is that the basic functionality you're
seeking is in fact built into MySQL :))
If you need to mangle your CSV file (before it can go into MySQL, based on
your CSV file being very different arranged or formatted than the DB it
shall go into), that is another story...
ben
On 8/22/07, Ron LeVine <levine.ron at gmail.com> wrote:
>
> Well, guys, you both are talking way over my head on this.
>
> Oh well.
>
> Thanks anyways,
> Ron
>
> On 8/22/07, larry price < laprice at gmail.com> wrote:
> >
> > On 8/22/07, Ron LeVine < levine.ron at gmail.com> wrote:
> > > Greetings all,
> > >
> > > I have a .csv file from a spreadsheet that I want to import into a
> > MySQL db.
> > > Unfortunately, the format of the file is not the same as the field
> > list in
> > > MySQL so I think I need a script to parse the file and then do the
> > MySQL
> > > commands to place the data where it goes.
> > >
> >
> > This is a very straightforward data filter script, the general pattern
> > goes like this
> >
> > using your favourite scripting language
> >
> > read each line of the file into a hash table (dictionary)
> >
> > write the output function that does whatever formatting, interpolation
> > and calculation you need to produce the database table row you need
> > from the hash structure you have.
> >
> > apply the output function to each line, and either stuff the result
> > into the database directly, or into a file for importation later.
> >
> > (for larger data sets the copy function your DBMS has is significantly
> > faster than inserting row by row)
> >
> >
> >
> >
> >
> >
> > > I am not much of a script guy. Anyone care to assist on this???
> > >
> > > Thanks in advance,
> > > Ron
> > >
> > > _______________________________________________
> > > EUGLUG mailing list
> > > euglug at euglug.org
> > > http://www.euglug.org/mailman/listinfo/euglug
> > >
> > >
> > _______________________________________________
> > EUGLUG mailing list
> > euglug at euglug.org
> > http://www.euglug.org/mailman/listinfo/euglug
> >
>
>
> _______________________________________________
> EUGLUG mailing list
> euglug at euglug.org
> http://www.euglug.org/mailman/listinfo/euglug
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://euglug.org/pipermail/euglug/attachments/20070822/3e74b894/attac=
hment-0001.htm
More information about the EUGLUG
mailing list