[Dbix-class] establishing relationship across databases

Sungsam Gong gong.sungsam at gmail.com
Thu Sep 20 10:39:30 GMT 2012


Hi Peter,

What I meant by 'database' is actually 'schema':
<Model::CARDIODB>
    schema_class Nectar::Schema::CARDIODB
...
</Model::CARDIODB>
<Model::UNIPROT>
    schema_class Nectar::Schema::UNIPROT
...
</Model::UNIPROT>

So they are in different schema within the same physical database host.

I also found this (NB. this coobook is based on my local DBIx version):
http://search.cpan.org/~abraxxa/DBIx-Class-0.08195/lib/DBIx/Class/Manual/Cookbook.pod#Relationships_across_DB_schemas

I think that's what you explained below.

Thanks.
Sung


On 20 September 2012 11:27, Peter Rabbitson <rabbit+dbic at rabbit.us> wrote:
> 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::*
>
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk



More information about the DBIx-Class mailing list