[Dbix-class] A problem with Postgres schemas
Kevin Esteb
kesteb at wsipc.org
Thu Dec 28 21:06:51 GMT 2006
I new to DBIx::Class, so please bear with me.
I am running RHEL4 and have a postgres database with a schema named
"analog". The DBIx::Class modules are the latest and greatest from CPAN,
so is the DBD and the DBI for postgres. When I run the below code, I get
this error:
DBIx::Class::Schema::resultset(): Can't find source for analog.master at
test9.pl line 28
What is the proper way to access another database schema within
postgres.
Thanks
package Test::Schema;
use base qw/ DBIx::Class::Schema /;
__PACKAGE__->load_classes();
1;
package Test::Schema::Master;
use base qw/ DBIx::Class /;
__PACKAGE__->load_components(qw/ PK::Auto Core /);
__PACKAGE__->table('analog.master');
__PACKAGE__->add_columns(qw/ hostname datetime did /);
__PACKAGE__->set_primary_key('hostname');
1;
package Test;
my $dsn = 'dbi:Pg:dbname=monitor';
my $username = 'postgres';
my $password = '';
my $params = {RaiseError => 1, AutoCommit => 0};
eval {
my $schema = Test::Schema->connect($dsn, $username, $password,
$params);
my @masters = $schema->resultset('analog.master')->search();
foreach my $master (@masters) {
print "$master->hostname, $master->datetime, $master->did\n";
}
}; if ($@) { print "$@\n"; }
1;
More information about the Dbix-class
mailing list