开发者

Purge postgres database using perl

I have a Postgres purging script in bash where I used to run multiple commands on different tables i.e.

  • copy data to temp table. i.e. table1 -> temp_table1

  • delete data from original table based on the temp tables.

for both the above steps, for each table I am connecting to the database. Is there a way to connect to database at on开发者_Go百科ce and execute the above steps on different tables using Perl.


use DBI;
my $dbh = DBI->connect($data_source, $username, $auth, \%attr);
$dbh->do($statement1);
$dbh->do($statement2);

See the DBI docs for more details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜