Add a foreign key to the triple table.
This commit is contained in:
parent
1814b23b46
commit
3e445a3133
|
@ -105,10 +105,14 @@ class Item(Base):
|
||||||
|
|
||||||
class Triple(Base):
|
class Triple(Base):
|
||||||
__tablename__ = 'triple'
|
__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)
|
predicate_id = Column(Integer, primary_key=True, index=True)
|
||||||
object_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):
|
class HumanItem(Base):
|
||||||
__tablename__ = 'human'
|
__tablename__ = 'human'
|
||||||
item_id = Column(Integer, primary_key=True, autoincrement=False)
|
item_id = Column(Integer, primary_key=True, autoincrement=False)
|
||||||
|
|
Loading…
Reference in a new issue