123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- # -*- coding: utf-8 -*-
- from sqlalchemy import String, Column, Integer,DateTime,Text,Date,Time,ForeignKey
- from database import Base
- from sqlalchemy.orm import relationship
- from datetime import datetime
- class AppInfo(Base):
- """
- 应用表
- """
- __tablename__ = "tp_app_info"
- app_id = Column(String(100), primary_key=True)
- app_secret = Column(String(100))
- hashed_secret = Column(String(100))
- app_name = Column(String(100))
- note = Column(String(100))
- def __repr__(self):
- return "<AppInfo>{}:{}".format(self.app_id, self.app_secret)
- class Config:
- orm_mode = True
- class ApiServiceEntity(Base):
- __tablename__ = "tp_api_service"
- id = Column(String(100), primary_key=True)
- name = Column(String(100))
- status = Column(String(100))
- create_time = Column(DateTime, default=datetime.now)
- class Config:
- orm_mode = True
- class DatasourceEntity(Base):
- __tablename__ = "tp_datasource"
- id = Column(String(100), primary_key=True)
- name = Column(String(100))
- scope = Column(String(100))
- dsn = Column(String(100))
- dbtype = Column(String(100))
- host = Column(String(100))
- user = Column(String(100))
- password = Column(String(100))
- database = Column(String(100))
- port = Column(Integer)
- charset = Column(String(100))
- class Config:
- orm_mode = True
- class CommandEntity(Base):
- __tablename__ = "tp_command"
- id = Column(String(100), primary_key=True)
- sqltext = Column(String(100))
- datasource = Column(String(100))
- scope = Column(String(100))
- update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now)
- class Config:
- orm_mode = True
- class OprIdxStat(Base):
- """
- 指标统计表
- 统计各项指标
- """
- __tablename__ = "opr_idx_stat"
- id = Column(Integer, primary_key=True, autoincrement=True, comment='id')
- stat_dt = Column(DateTime,comment='统计日期')
- stat_lvl = Column(Integer,comment='统计级别 1地市2市有关单位3区县')
- area_id = Column(String(100),comment='行政区划编码')
- area_nm = Column(String(100),comment='行政区划名称')
- index_no = Column(String(100),comment='指标编号')
- index_nm = Column(String(100),comment='指标名称')
- index_value = Column(String(100),comment='指标度量值')
- index_unit = Column(String(100), comment='指标单位')
- etl_time = Column(DateTime,comment='etl加工时间戳')
-
- class Config:
- orm_mode = True
- class OprIdx(Base):
- """
- 指标表
- 存储各项指标,记录统计sql
- """
- __tablename__ = "opr_idx"
- id = Column(Integer, primary_key=True, autoincrement=True, comment='id')
- index_no = Column(String(100),comment='指标编号')
- index_nm = Column(String(100),comment='指标名称')
- index_sql = Column(Text,comment='指标统计sql')
- index_corn = Column(String(100), comment='执行指标corn表达式')
- create_time = Column(DateTime,comment='创建时间')
-
- class Config:
- orm_mode = True
|