[Dbix-class] Newbie question on arbitrary joins

Matt S Trout dbix-class at trout.me.uk
Wed Nov 12 21:13:09 GMT 2008


On Thu, Oct 16, 2008 at 02:49:46PM -0700, Amelia Ireland wrote:
> Hello,
> 
> I have a question on joining tables without using the relationships  
> defined in the DB schema. I can formulate the query in standard SQL,  
> but getting it into DBIx::Class speak is proving a little tricky.
> 
> I have the following set up:
> 
> association JOIN term ON association.term_id=term.id
> 
> association LEFT JOIN graph_path ON  
> association.term_id=graph_path.term2_id
> 
> association JOIN gene_product ON  
> association.gene_product_id=gene_product.id
> 
> What I want to do is an 'artificial' join on the association table to  
> match up tables by gene_product_id so that I don't have to include the  
> extra table in my search.

Just create the relationship then. DBIx::Class doesn't care if it matches a
foreign key or not, it just does what you tell it to.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the DBIx-Class mailing list