I've run into this a variant of this same problem several times now,
so I want to ask if you know of a good way to solve the problem.

Some relation()s are based on extra criteria (besides primary key
joins), but otherwise would be nice to work just like normal relation
properties.

A simplified example:

  Say you have two entities: *Product and Sale*:

Product (productid, regularprice, description)

and

Sale (productid, startingdate, endingdate, saleprice)

I would like to be able to add a relationship() to the Product mapper
for a 'sales' collection, but be able to *pass in the date*, so that I
can populate a Product instance's 'sales' property, like prod.sales,
as a [list of Sale objects joined by primary key with filter of passed
date].

I believe I can get there with contains_eager(), but then the problem
is I need to redefine this query over each place I use it, instead of
being able to tell the *mapper* about it and treat it like a normal
relationship.

Is there an elegant way to accomplish this type of "conditional" join/
relation?

Thanks in advance,
Kent

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to