next_id = Column(Integer, ForeignKey('pages.id'), nullable=True)
next = relationship('Page', primaryjoin='pages.c.next_id==pages.c.id',
    remote_side='Page.id', backref=backref('prev', uselist=False))
Multiple self referential relationships in SQLAlchemy