INNER CODE UNIT · Python
Authors
marty331/fasthtmx · models/models.py:7
class Authors(Base):
__tablename__ = "authors"
id = Column(Integer, primary_key=True, index=True)
first_name = Column(String, index=True)
last_name = Column(String, index=True)
email = Column(String, unique=True, index=True)
books = relationship("Books", back_populates="author")
class Books(Base):
__tablename__ = "books"
id = Column(Integer, primary_key=True, index=True)
title = Column(String, index=True)
pages = Column(String, index=True)
author_id = Column(Integer, ForeignKey("authors.id"))