22 lines
681 B
Python
22 lines
681 B
Python
from sqlalchemy import *
|
|
from sqlalchemy.orm import *
|
|
|
|
from database import Base
|
|
|
|
|
|
class Emp(Base):
|
|
__tablename__ = "wl_emp"
|
|
|
|
stu_id = Column(Integer,ForeignKey('wl_student.stu_id'), primary_key=True, autoincrement=True)
|
|
emp_open_time = Column(DateTime, default="2026-11-30 18:18:18")
|
|
offer_time = Column(DateTime, default=func.now())
|
|
company_name = Column(String(100), nullable=False)
|
|
salary = Column(Integer, nullable=False, default=15000)
|
|
|
|
# Student.emp 用的是 back_populates="student",这个反向属性必须保留,否则 mapper 配置失败
|
|
student = relationship("Student", back_populates="emp")
|
|
|
|
def __repr__(self):
|
|
pass
|
|
|