"""Period model.""" from sqlalchemy import Column from sqlalchemy import Enum from sqlalchemy import Index from sqlalchemy import Integer from sqlalchemy import SmallInteger from sqlalchemy.sql import text from manualadjustment.connectors import mysql class Period(mysql.ArtRelationsBaseModel): """Model for the period table.""" __tablename__ = 'period' __table_args__ = ( Index('year_quarter', 'year', 'quarter'), Index('year_month', 'year', 'month', unique=True)) period_id = Column(Integer, primary_key=True) year = Column(SmallInteger, nullable=False) quarter = Column(Integer, nullable=False) month = Column(Integer, nullable=False) status = Column( Enum('open', 'closed', 'processing'), server_default=text("'open'"))