[Sqlalchemy-tickets] Issue #3065: class attributes with parent/child in the name (zzzeek/sqlalchemy
Brought to you by:
zzzeek
From: igorsf <iss...@bi...> - 2014-05-31 05:05:15
|
New issue 3065: class attributes with parent/child in the name https://bitbucket.org/zzzeek/sqlalchemy/issue/3065/class-attributes-with-parent-child-in-the igorsf: The following declaration returns an error "could not assemble any primary key columns". I traced the problem to the names of the attributes in the class "parent" and "child". ORM doesn't see any attributes with parent or child in the name. If you rename class attributes and remove "parent" and "child" keywords it works. Doesn't work: class Association(Base): __tablename__ = 'association' parent_left_id = Column(Integer, ForeignKey('parent_left_id.id'), primary_key=True) child_right_id = Column(Integer, ForeignKey('child_right_id.id'), primary_key=True) extra_data = Column(String(50)) child = relationship("Child") Works fine: class Association(Base): __tablename__ = 'association' left_id = Column(Integer, ForeignKey('parent_left_id.id'), primary_key=True) right_id = Column(Integer, ForeignKey('child_right_id.id'), primary_key=True) extra_data = Column(String(50)) child = relationship("Child") |