में एकाधिक आत्म रेफरेंसियल रिश्ते मेरे पास एक डेटाबेस मॉडल है जहां मुझे एक से कई रिश्तों और दो-से-एक संबंधों की आवश्यकता है। यहाँ मॉडल मैं कर दिया है, लेकिन यह त्रुटियोंएसक्यूएलकेमी
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)
children = relationship("Page", backref=backref("parent", remote_side=id))
next_id = Column(Integer, ForeignKey("pages.id"), nullable=True)
next = relationship("Page", backref=backref("prev", remote_side=id, uselist=False))
prev_id = Column(Integer, ForeignKey("pages.id"), nullable=True)
prev = relationship("Page", backref=backref("next", remote_side=id, uselist=False))
def __init__(self, title, content, parent_id=None, next_id=None, prev_id=None):
self.title = title
self.content = content
self.parent_id = parent_id
self.next_id = next_id
self.prev_id = prev_id
def __repr__(self):
return '<Page "%r">' % self.title
मैं निम्नलिखित त्रुटि मिलती है जब भी मैं डेटाबेस के लिए कुछ भी करने की कोशिश
ArgumentError: Could not determine join condition between parent/child tables on relationship Page.children. Specify a 'primaryjoin' expression. If 'secondary' is present, 'secondaryjoin' is needed as well.
क्या वास्तव में अजीब है कि यह अगले बिना काम किया है फेंक रहा है और पिछला कॉलम। किसी को पता है कि क्या गलत है?