ETLp::Loader::CSV - Load a CSV file's content into a table
This class is used to manage the job's audit record
use ETLp::Loader::CSV; my $loader = ETLp::Loader::CSV->new( table => 'table_name', columns => [qw/col1 col2 col3/] directory => '/data/incoming', ); my $status = $loader->load('data.csv'); unless ($status) { die $status->error; } print "Rows loaded: " $loader->rows_loaded;
Create a loader, specifying the characteristics
Parameters
* table: Required. The table the data is being loaded into * columns: Required. The columns in the table that we are inserting into. These should match the name of the file field names * directory: Optional. The directory where the load files are located. * localize: Optional. Whether to localize the input files (i.e. process the input file setting the appropriate newline character for the host OS)
Returns
* A ETLp::Loader::CSV object
Load a file into the specified table. If the directory attibute is set then this should be a relative path.
* The name of the file to be loaded
* Status. 1 - Success, 0 = failure
Returns the number of rows inserted by the last load
* None
* An integer
Copyright 2010 Redbone Systems Ltd
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
The terms are in the LICENSE file that accompanies this application
To install ETLp, copy and paste the appropriate command in to your terminal.
cpanm
cpanm ETLp
CPAN shell
perl -MCPAN -e shell install ETLp
For more information on module installation, please visit the detailed CPAN module installation guide.