Archives of the TeradataForum
Message Posted: Wed, 19 Oct 2005 @ 13:21:25 GMT
Subj: | | A new Perl interface to Teradata |
|
From: | | Geoffrey Rommel |
The following module is now available on CPAN. Please note that this is freeware and is available to any Perl user.
One question that comes up often on this forum is how to generate dynamic SQL for multiple tables; for instance, running something like "select
count(*) from [table]" when you don't know the table name until run time. This module would be especially useful for such applications.
Teradata::BTET is a Perl interface to Teradata SQL. It does not attempt to be a complete interface to Teradata -- for instance, it does not
allow multiple sessions, asynchronous requests, or PM/API connections -- but it should be sufficient for many applications. The syntax is similar
to that of DBI, but this is not a DBI module.
A SIMPLE EXAMPLE
$dbh = Teradata::BTET::connect("dbc/bogart,bacall");
$sth = $dbh->prepare("select * from edw.sales");
$sth->open;
while ( @row = $sth->fetchrow_list ) {
... process the row ...
}
$sth->close;
$dbh->disconnect;
PREREQUISITES
This module requires:
Perl version 5.6.0 or later
a C compiler
Teradata Preprocessor2 (PP2) for C
At present, the module has been tested only on Solaris, but it should work on MP-RAS or other platforms with relatively few changes.
Those who are able to test it on MP-RAS, earlier versions of Perl, or other platforms are invited to collaborate.
|