[Dbix-class] Cross-schema relationships.

Oleg Pronin syber.rus at gmail.com
Mon Feb 1 17:35:12 GMT 2010


Postgres.

generated  SQL stays the same. Is it valid or not it's all on user's own.
For example if table 'user' is in Schema, and table 'message' is in Schema2
i would prefer to be able to do
$message->user; #generate select * from user where id = ...  ,  id
taken from $message object.

If i write $messageRS->search({...}, { prefetch => 'user' })   then it
is wrong, and i'll get database level error.

Just a part of functionality could be supported.

2010/2/1 Rob Kinyon <rob.kinyon at gmail.com>:
> On Mon, Feb 1, 2010 at 11:52, Oleg Pronin <syber.rus at gmail.com> wrote:
>> Hi everyone.
>>
>> I'm separating a part of database tables to second database server.
>> Therefore i created second schema and put a part of result sources in
>> there.
>>
>> I discovered that cross-schema relationships doesn't work: i get error
>> DBIx::Class::ResultSource::related_source(): Can't find source for
>> MyApp::Schema::SomeRS at ...
>> when i try to get related source from Schema2 to Schema
>>
>> Is there an easy way to workaround on it ? i understand that table
>> joins are not possible anymore, but in theory DBIC could continue to
>> support relationships without joins.
>> $obj->many_to_many_accessor->search(...), etc
>
> How would you write the SQL to do this? Also, what RDBMS are you on?
> Is it Oracle?
>
> Rob
>
> _______________________________________________
> 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