The one thing that I see as missing from this join is a ForeignKey, like so:
asset = relation(Asset, backref=backref('evidences'), primaryjoin= device_id
== Asset.device_id, foreign_keys=Evidence.id)
On Wed, Jul 21, 2010 at 6:30 PM, Gisborne <[email protected]> wrote:
> Can't get a simple #...@%#(#* relation to work. With these, I get "Could
> not locate any equated, locally mapped column pairs for primaryjoin
> condition 'evidence.device_id = assets.device_id' on relation
> Evidence.asset"
>
> class Evidence(DeclarativeBase):
> __tablename__ = 'evidence'
>
> __table_args__ = {'useexisting': True}
>
> ...
> device_id = Column(Unicode, ForeignKey('assets.device_id'))
> asset = relation(Asset, backref=backref('evidences'), primaryjoin
> = device_id == Asset.device_id)
>
> class Asset(DeclarativeBase):
> __tablename__ = 'assets'
>
> __table_args__ = {'useexisting': True}
>
> ...
> device_id = Column(Unicode, unique=True)
>
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<turbogears%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/turbogears?hl=en.
>
>
--
Michael J. Pedersen
My IM IDs: Jabber/[email protected], ICQ/103345809, AIM/pedermj022171
Yahoo/pedermj2002, MSN/[email protected]
--
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears?hl=en.