[Dbix-class] establishing relationship across databases

Peter Rabbitson rabbit+dbic at rabbit.us
Thu Sep 20 10:27:32 GMT 2012


On Thu, Sep 20, 2012 at 11:18:41AM +0100, Sungsam Gong wrote:
> Hi,
> 
> I have been creating a manual relationship between tables (mysql
> MyISAM) within the same database, which worked very well for my
> purpose.
> Just wondering whether it's possible to make a relationship between
> two tables each of which residues in different database.

What do you mean when you say `database`? The mysql notion of `database` 
which resides on the same physical server, or `database` as in separate 
mysql instances? If the later - no this is not possible.

If the former - you can only have relationships within one *logical* 
$schema. Individual sources however can refer to fully qualified tables, 
e.g.:

in Foo::Table1
__PACKAGE__->table('db1.table1');

in Bar::Table1
__PACKAGE__->table('db2.table1');

In other words you need to teach a Nectar::Schema::Complete about both
Nectar::Schema::UNIPROT::* and Nectar::Schema::CARDIODB::*




More information about the DBIx-Class mailing list