node_to_node = Table('node_to_node', Base.metadata, Column('left_node_id',
    Integer, ForeignKey('node.id'), primary_key=True), Column(
    'right_node_id', Integer, ForeignKey('node.id'), primary_key=True))


class Node(Base):
    __tablename__ = 'node'
id = Column(Integer, primary_key=True)
label = Column(String)
right_nodes = relationship('Node', secondary=node_to_node, primaryjoin=id ==
    node_to_node.c.left_node_id, secondaryjoin=id == node_to_node.c.
    right_node_id, backref='left_nodes')
Create many to many on one table