Answer the question
In order to leave comments, you need to log in
How to automatically replace name with id?
Good day!
Now there is a table like this:
class TestResults(Base):
id = Column(Integer, primary_key=True)
test_name = Column(String)
result = Column(Integer)
class TestName(Base):
id = Column(Integer, primary_key=True)
name = Column(String)
class TestResults(Base):
id = Column(Integer, primary_key=True)
result = Column(Integer)
name_id = Column(Integer, ForeignKey('test_name.id'), nullable=False)
name = relationship("test_name", foreign_keys=[name_id])
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question