You probably want to take a look at http://www.sqlalchemy.org/docs/05/mappers.html#adjacency-list-relationships
On Feb 23, 5:42 pm, flya flya <[email protected]> wrote: > here is code: > > Base = declarative_base() > class Page(Base): > __tablename__ = 'pages' > id = Column(Integer, primary_key=True) > parent_id = Column('parent_id', Integer, ForeignKey('pages.id')) > > children = relation('Page', backref='parent') > > I get error information: > sqlalchemy.exc.ArgumentError: Page.children and back-reference > Page.parent are both of the same direction <symbol 'ONETOMANY>. Did > you mean to set remote_side on the many-to-one side ? > > when change the code > children = relation('Page', backref='parent') > to > childen = relation('Page') > It can work , but I can only get 'children' no 'parent' from a Page instant. -- 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.
