Tefnet Developers wrote: > > class Location(PhysObject): > Id = sqlalchemy.Column(sqlalchemy.types.Integer, > sqlalchemy.ForeignKey(PhysObject.Id), primary_key=True) > description = sqlalchemy.Column( sqlalchemy.types.String(128)) > > > PhysObject.location = sqlalchemy.orm.relation( > Location, > primaryjoin = PhysObject.locationId == Location.Id, > foreign_keys = [PhysObject.locationId], > remote_side = [Location.Id] > )
Location.id is actually a share of the "id" columns on Location, PhysObject, TefObject. You need to assign a distinct "location_id" attribute on the Location class which identifies that column uniquely, although that messes up the approach you have in your custom metaclass....so you can also set up primaryjoin using the actual table columns (i.e. PhysObject.locationId == Location.__table__.c.id). --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
