18 lines
471 B
Python
18 lines
471 B
Python
from sqlalchemy import Column, Integer, String
|
|
from sqlalchemy.orm import relationship
|
|
from sqlalchemy.ext.declarative import declarative_base
|
|
|
|
from .book import Book
|
|
|
|
Base = declarative_base()
|
|
|
|
|
|
class Author(Base):
|
|
__tablename__ = 'author'
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
first_name = Column(String(50), nullable=False)
|
|
last_name = Column(String(50), nullable=False)
|
|
|
|
books = relationship('Book', back_populates='author')
|