# 定义表格映射类 from sqlalchemy import Column, Integer, String from sqlalchemy.orm import declarative_base ''' 行业板块数据表 ''' class IndustrySector(declarative_base()): __tablename__ = 'stock_industry_sector' id = Column(Integer, primary_key=True, autoincrement=True) trade_date = Column(String, nullable=False) sector_name = Column(String) pct_change = Column(String) total_volume = Column(String) total_turnover = Column(String) net_inflows = Column(String) rising_count = Column(String) falling_count = Column(String) average_price = Column(String) leading_stock = Column(String) leading_stock_latest_price = Column(String) leading_stock_pct_change = Column(String) # 创建索引 # trade_date_index = Index('idx_trade_date', IndustrySector.trade_date) # sector_name_index = Index('idx_sector_name', IndustrySector.sector_name)