On Jun 10, 2008, at 4:29 AM, Paul Johnston wrote:

> Hi,
>> VulnResDesc.mapper.add_property('rawvulns',  
>> sao.relation(VulnRes.mapper,
>>     primaryjoin = sa.and_(VulnRes.targetid == VulnResDesc.targetid,
>>                        VulnMap.vulndescid == VulnResDesc.id,
>>                        VulnMap.tool == VulnRes.tool,
>>                        VulnMap.toolvulnid == VulnRes.toolvulnid),
>>     foreign_keys = [VulnResDesc.c.targetid, VulnResDesc.c.id],
>>     viewonly = True,
>>     uselist = True))
> ultimately all relations distill the join condition into a set of  
> pairs, above it would be:
> [ (VulnResDesc.targetid, VulnRes.targetid) ]
>
> I still don't quite understand this I'm afraid, I though there were  
> more columns involved - VulnResDesc.id, VulnRes.tool,  
> VulnRes.toolvulnid.
>
> So using foreign_keys which only deals with these columns should  
> probably work by itself:
> foreign_keys = [VulnResDesc.targetid]
> The remote_side argument, if needed, would be remote_side=  
> [VulnRes.targetid] since that is the "right" side of the relation.
>
> Ok, if I set foreign_keys like that, it doesn't ask me for a  
> remote_side, BUT when I come to actually use the relation, the query  
> runs for a long time, in fact my web app times out before it  
> completes.

in that case you'd probably want to set remote_side as well.   the  
query running forever implies that the lazyload isnt actually putting  
a bind parameter in anywhere.

To see how these settings translate in the propertyloader, you can  
turn on  
logging 
..logging 
.getLogger('sqlalchemy.orm.properties').setLevel(logging.INFO) .


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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