[sqlalchemy] Re: M:N self-reference

2009-11-09 Thread Wade Leftwich
Something exactly like that. Thanks much. On Nov 8, 11:28 pm, Mike Conley mconl...@gmail.com wrote: Something like this? The association table is declared in the relationships, but never referenced when creating or accessing objects. class Assoc(Base):     __tablename__ = 'assoc'    

[sqlalchemy] Re: M:N self-reference

2009-11-08 Thread Mike Conley
Something like this? The association table is declared in the relationships, but never referenced when creating or accessing objects. class Assoc(Base): __tablename__ = 'assoc' parent = Column(Integer, ForeignKey('m_to_n.id'), primary_key=True) child = Column(Integer,

[sqlalchemy] Re: M:N self-reference

2009-11-05 Thread Mike Conley
Short answer, no. Think about it this way. In a simple 1:n relationship, each child has a pointer to the parent. In a m:n relationship, each child must have a pointers to many parents and those pointers must live somewhere. In a relational database, there is no way to store an arbitrary number