class Page(Base):
    __tablename__ = 'pages'
id = Column(Integer, primary_key=True)
title = Column(String(100), nullable=False)
content = Column(Text, nullable=False)
parent_id = Column(Integer, ForeignKey('pages.id'), nullable=True)
parent = relationship('Page', Forein_keys=[parent_id], remote_side=[id],
    backref=backref('children'))
next_id = Column(Integer, ForeignKey('pages.id'), nullable=True)
next = relationship('Page', Forein_keys=[next_id], remote_side=[id],
    backref=backref('prev', uselist=False))
Multiple self referential relationships in SQLAlchemy