Add a foreign key to the triple table.

This commit is contained in:
Edward Betts 2019-12-22 10:22:46 +00:00
parent 1814b23b46
commit 3e445a3133

View file

@ -105,10 +105,14 @@ class Item(Base):
class Triple(Base):
__tablename__ = 'triple'
subject_id = Column(Integer, primary_key=True)
subject_id = Column(Integer,
ForeignKey('item.item_id'),
primary_key=True)
predicate_id = Column(Integer, primary_key=True, index=True)
object_id = Column(Integer, primary_key=True, index=True)
subject = relationship('Item', backref='triples')
class HumanItem(Base):
__tablename__ = 'human'
item_id = Column(Integer, primary_key=True, autoincrement=False)