left = relationship('NodeClass', remote_side=[node_id], primaryjoin=
    'NodeClass.left_id==NodeClass.node_id', backref=backref('right',
    uselist=False))
Using SQLAlchemy with multiple self-referential foreign keys