Hi all,
I am trying to created self references to a Table, I actually need two
self references back to the same Table.
matches = relationship("Criterion")
merges = relationship("Criterion")
What I notice happens is the references are getting mixed up. Hence
when I add to matches it adds to the merges property.
Is there a better / cleaner way of doing this?
Here's what I have for now:
class Criterion(Base):
__tablename__ = 'criterion'
criterion_id = Column(Integer, Sequence('criterion_sequence'),
primary_key=True)
standard_id = Column(Integer, ForeignKey('standard.standard_id',
ondelete="CASCADE"), nullable=False)
source_id = Column(Integer, ForeignKey('criterion.criterion_id'),
nullable=True)
number = Column(Integer())
title = Column(Text())
statement = Column(Text())
created = Column(DateTime, default=func.current_timestamp())
last_updated = Column(DateTime, default=func.current_timestamp(),
onupdate=func.current_timestamp())
matches = relationship("Criterion")
merges = relationship("Criterion")
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.