Files
mariadb-dev-example-blog-sa…/mariadb_python_sqlalchemy/part_2/onboarding/department.py
2021-04-20 12:46:20 -05:00

14 lines
358 B
Python

from sqlalchemy import Column, String, Integer, ForeignKey
from sqlalchemy.orm import relationship
from base import Base
class Department(Base):
__tablename__ = 'departments'
id = Column(Integer, primary_key=True)
name = Column(String(length=50))
employees = relationship("Employee")
def __init__(self, name):
self.name = name