Hi,
I have had the following relation working ok for some time, but a recent
update of SQLAlchemy means it's now asking for a remote_side argument. I'm
really not too sure what too put in there - I've never really understood
that parameter, or foreign_keys.
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))
If you'd like some explanation what it's doing, this is part of a tracking
system for security scans. VulnRes is each raw result from a tool, VulnDesc
(not used here) is a textual description of a finding, and VulnMap maps
VulnRes to VulnDesc. VulnResDesc is a view, that gets the distinct
VulnDesc's for each Target. The idea is that the rawvulns relation takes you
from a VulnDesc on a particular Target, to a list of the VulnRes that relate
to this. Not an easy relation :-)
So, what do I put in remote_side? I tried copying foreign_keys, and the app
started, but the relation is always empty.
Any help appreciated!
Paul
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---