NAME
ETLp::Loader::CSV - Load a CSV file's content into a table
DESCRIPTION
This class is used to manage the job's audit record
SYNOPSIS
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;
METHODS
new
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
Load a file into the specified table. If the directory attibute is set then this should be a relative path.
Parameters
* The name of the file to be loaded
Returns
* Status. 1 - Success, 0 = failure
rows_loaded
Returns the number of rows inserted by the last load
Parameters
* None
Returns
* An integer
LICENSE AND COPYRIGHT
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