DBI::Dumper(3)
π NAME π
DBI::Dumper β bestie, this one dumps data from a DBI datasource straight to a file. slay. π
πΈ SYNOPSIS πΈ
Okay so first, your control file vibe:
<< in test.ctl >>
OPTIONS (export=100,rows=100)
EXPORT DATA REPLACE INTO FILE 'test.dat'
FIELDS TERMINATED BY TAB
ENCLOSED BY '"' AND '"'
ESCAPED BY '\'
WITH HEADER FROM
SELECT * FROM MY_TABLE
Then the actual perl, in all its glory:
my $dumper = DBI::Dumper->new(
-dbh => $dbh,
-control => 'test.ctl',
-output => 'test.dat',
);
$dumper->prepare;
$dumper->execute;
# have DBI::Dumper login to database
my $dumper = DBI::Dumper->new(
-userid => 'user/pass@sid',
...
);
# send a statement handle instead of database handle
my $sth = DBI->connect()->prepare("SELECT * FROM MY TABLE");
$dumper->execute($sth);
π¦ DESCRIPTION π¦
It dumps data from a select statement into an output file. dbidumper is out here trying to mirror the functionality and behavior of sql*loader β the control file syntax is similar, and DBI::Dumper utilizes a subset of the sql*loader options. it's giving "inspired by", no cap. β¨
Configuration options can be set either in the control file, passed to the new() method, or by calling the option's accessor. three ways to do the thing, pick your fave. π
β¨ Options β¨
userid=username/password@sidβ Login information for database connection, duh. π
If the sid includes a colon, the full string will be used as the DBI dsn. Like:
userid=username/password@mysql:database
Will connect to mysql's 'database' database as username. iconic.
Otherwise, DBI::Dumper assumes a dbi:Oracle connection and prefixes the dsn with dbi:Oracle:. And if no dsn is passed at all? DBI::Dumper first looks in $ENV{DBI_DSN} then $ENV{ORACLE_SID}. it's doing a little detective work fr fr. π
control=filenameβ Input control filename. Defaults to standard input. See "CONTROL FILE" for layout and description.output=filenameβ Output filename for data. Defaults to standard output. Ifrowsis given, can contain template consisting of three or more Xs. The Xs will be replaced with the file sequence number. If the template does not contain three or more Xs, the sequence number will be appended to the filename with a dot. Examples:rows=nβ Number of rows per output file. Defaults to all rows in one output file.export=nβ Total number of rows to export. Use to limit output or restart dump.skip=nβ Number of rows to skip from beginning. File sequence number will be preserved, so ifrows=nis set, this can be used to restart a job. lowkey a lifesaver. π«Άbindsize=nβ Block size to write file. Defaults to write each record as returned from database. If set,dbidumperwill collect rows into a buffer at most n bytes large before writing to file.silent=trueβ Suppress normal logging information.dbidumperwill only report errors. the quiet girlie setting. π
π Exporting to Multiple Files π
rows=1000 output=outputXXXXX.datβ Data will be written tooutput00001.dat,output00002.dat, etc.rows=1000 output=output.datβ Data will be written tooutput.dat.0001,output.dat.0002, etc.output=outputXXXXX.datβ Data will be written tooutputXXXXX.dat
π DEPENDENCIES π
This program depends on the following perl modules, available from a CPAN mirror near you: π
- Parse::RecDescent β Recursive parser
- DBI β Standard database interface
π CONTROL FILE π
The control file used for dbidumper is very similar to sql*loader's. The full specification is, and yes you need all of it:
[ OPTIONS ([option], ...) ]
EXPORT DATA [ REPLACE | APPEND ] [ INTO FILE 'filename' ]
[ FIELDS
[ TERMINATED [BY] {TAB | 'string' | X'hexstring'} ] |
[ ENCLOSED [BY] {'string' | X'hexstring'}
[AND] ['string' | X'hexstring'] ]
[ ESCAPED [BY] {'string' | X'hexstring'} ]
]
[ WITH HEADER ]
FROM
select_statement
π AUTHOR π
Written by Warren Smith (warren.smith@acxiom.com). king behavior honestly. π
π BUGS π
None yet.
and that's the whole page bestie β this doc was shipped with perl v5.42.0, dated 2025-07-25, and it lives in section DBI::Dumper(3). go forth and dump responsibly π¦β¨
π¦ where this page comes from
- fedora 43: perl-DBI-Dumper 2.01-61.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms