self-relationship table bad work child/parent key
Issue #3627
closed
Hi, i use one table in above model and insert to database (image 1) and i set breakpoint and i see first record ForeignKey (parent_id=Null ) with id=1 and second record with ForeignKey (parent_id=1) and first record id=1 return list in children in second record but i see (image 2) full children list in first record in sele ,
class Student(Base):
__tablename__ = 'reltest' id = Column(Integer, primary_key=True) name = Column(String(50)) fullname = Column(String(50)) password = Column(String(50)) parent_id = Column(Integer, ForeignKey('reltest.id'),index=True) children = relationship(lambda: Student)
Comments (3)
-
repo owner -
reporter Thanks, I ask you there is problem on sqlalchemy , I read docs for this , I think should fix issue
-
repo owner - changed status to closed
- Log in to comment
hi -
unfortunately I cannot work with screenshots as a means to understand or reproduce your issue. Please specify a succint, reproducing test case for your issue using the guidelines at http://stackoverflow.com/help/mcve - thanks!