开发者

Purge postgres database using perl

开发者 https://www.devze.com 2023-01-23 02:55 出处:网络
I have a Postgres purging script in bash where I used to run multiple commands on different tables i.e.

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

精彩评论

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