Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

hide (4398)

hide
  (email not shown publicly)
http://blogs.sackheads.org/hide

hide has been programming in Perl since 1998. Much of this time has been focused on system automation and data warehousing.

On CPAN as: SSORICHE [cpan.org]

Journal of hide (4398)

Saturday June 19, 2004
09:14 PM

DBD::CSV

[ #19380 ]
Part of my current project at work is to take a CSV log file created by an application server, parse it for entries that meet the criteria, and insert them into a Postgres table. In the past I'd read in each line, split it into 30 different variables (only 5 of which I care about) run it through multiple if statements to make sure it's the data I need to store.

I've been reading Programming the Perl DBI [oreilly.com] and had skimmed through the section on DBD::CSV. I quickly wrote up a proof of concept using DBD::CSV and was impressed. Getting the exact data that I wanted out of the log file was much simpler and straightforward with a SQL select compared to all the if statements.

Now to roll this into production.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.