예제 #1
0
class VoicemailMessage(Base):
    __tablename__ = 'voicemail_messages'
    __table_args__ = (Index('index', 'mailboxuser', 'mailboxcontext',
                            'read'), )

    id = Column(BIGINT(20), primary_key=True, unique=True)
    msgnum = Column(INTEGER(4), nullable=False)
    dir = Column(String(128), nullable=False, index=True)
    context = Column(String(80), nullable=False)
    macrocontext = Column(String(80))
    callerid = Column(String(40), nullable=False)
    origtime = Column(String(40), nullable=False)
    duration = Column(String(20), nullable=False)
    mailboxuser = Column(INTEGER(11), nullable=False)
    mailboxcontext = Column(String(80), nullable=False)
    recording = Column(MEDIUMBLOB, nullable=False)
    content = Column(MEDIUMTEXT)
    label = Column(String(30), nullable=False)
    read = Column(TINYINT(1), nullable=False)
    answered = Column(TINYINT(1), nullable=False)
    flag = Column(String(10), nullable=False)
    deleted = Column(TINYINT(1), nullable=False)
    voicemail_messagescol = Column(String(45))
    msg_id = Column(String(40))
예제 #2
0
class MAC_PARAMETER(Base):
    """
    宏观经济数据-编码表
    """
    __tablename__ = "MAC_PARAMETER"

    id = Column(Integer, primary_key=True)
    class_code = Column(Integer, nullable=False)
    class_name = Column(String(100), nullable=False)
    parameter_code = Column(Integer, nullable=False)
    parameter_name = Column(String(100), nullable=False)
    description = Column(String(200))
    status = Column(TINYINT(display_width=4), default=0)
    addtime = Column(TIMESTAMP, default=datetime.datetime.now)
    modtime = Column(TIMESTAMP)
예제 #3
0
파일: models.py 프로젝트: Bijaye/cobra
class CobraTaskInfo(db.Model):
    """
    Tasks for project
    """
    __tablename__ = 'tasks'
    __table_args__ = ({"mysql_charset": "utf8mb4"})

    id = db.Column(INTEGER(unsigned=True), primary_key=True, autoincrement=True, nullable=False)
    target = db.Column(db.String(255), nullable=False, default=None)
    branch = db.Column(db.String(64), nullable=False, default=None)
    scan_way = db.Column(SMALLINT(6), nullable=False, default=None)
    new_version = db.Column(db.String(40), nullable=False, default=None)
    old_version = db.Column(db.String(40), nullable=False, default=None)
    time_consume = db.Column(db.Integer, nullable=False, default=None)
    time_start = db.Column(db.Integer, nullable=False, default=None)
    time_end = db.Column(db.Integer, nullable=False, default=None)
    file_count = db.Column(db.Integer, nullable=False, default=None)
    code_number = db.Column(db.Integer, nullable=False, default=None)
    status = db.Column(TINYINT(4), nullable=False, default=0, index=True)
    created_at = db.Column(db.DateTime, nullable=False, default=None)
    updated_at = db.Column(db.DateTime, nullable=False, default=None)

    def __init__(self, target, branch, scan_way, new_version, old_version, time_consume, time_start, time_end, file_count, code_number, status, created_at=None, updated_at=None):
        self.target = target
        self.branch = branch
        self.scan_way = scan_way
        self.new_version = new_version
        self.old_version = old_version
        self.time_consume = time_consume
        self.time_start = time_start
        self.time_end = time_end
        self.file_count = file_count
        self.code_number = code_number
        self.status = status
        self.created_at = created_at
        self.updated_at = updated_at
        current_time = time.strftime('%Y-%m-%d %X', time.localtime())
        if created_at is None:
            self.created_at = current_time
        else:
            self.created_at = created_at
        if updated_at is None:
            self.updated_at = current_time
        else:
            self.updated_at = updated_at

    def __repr__(self):
        return '<task_info %r - %r>' % (self.id, self.target)
예제 #4
0
class Index(db.Model):
    __tablename__ = 'indexs'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(64))
    url = db.Column(db.String(255))
    html = db.Column(LONGTEXT)
    status = db.Column(TINYINT(3), default=0)
    dateline = db.Column(db.DateTime(), default=datetime.utcnow)
    lists = db.relationship('List', backref='list', lazy='dynamic')

    @staticmethod
    def index_add(name):
        collect = create_collect(name)
        url = collect.base_url
        html = collect.spi.get_source(url)
        if html:
            index_list = collect.spi.get_index_list(html)
            # print(index_list)
            for url, name in index_list:
                real_url = collect.base_url + url
                index = Index.query.filter_by(url=real_url).first()
                if index is None:
                    index = Index(name=name, url=real_url)
                    db.session.add(index)
                    db.session.commit()
            print('index_add: Success.')
        else:
            print('index_add: Html is None.')

    @staticmethod
    def index_edit(name):
        collect = create_collect(name)
        index_list = Index.query.filter_by(status=0).all()
        # print(index_list)
        if index_list:
            for index in index_list:
                html = collect.spi.get_source(index.url)
                if html:
                    index.html = html
                    index.status = 1
                    db.session.add(index)
                    db.session.commit()
            print('index_edit: Success.')
        else:
            print('index_edit: Index_list is None.')

    def __repr__(self):
        return '<Index %r>' % self.name
예제 #5
0
파일: Model.py 프로젝트: Jarsen136/chat
class HtAdmin(Base):
    __tablename__ = 'ht_admin'

    id = Column(INTEGER(11), primary_key=True)
    role_id = Column(INTEGER(11),
                     nullable=False,
                     server_default=text("'0'"),
                     comment='角色ID')
    name = Column(String(30),
                  nullable=False,
                  server_default=text("''"),
                  comment='admin888')
    pwd = Column(CHAR(32),
                 nullable=False,
                 server_default=text("''"),
                 comment='admin')
    mobile = Column(String(20),
                    nullable=False,
                    server_default=text("''"),
                    comment='手机号')
    email = Column(String(30),
                   nullable=False,
                   server_default=text("''"),
                   comment='邮箱')
    avatar = Column(String(150),
                    nullable=False,
                    server_default=text("''"),
                    comment='头像')
    status = Column(TINYINT(1),
                    nullable=False,
                    server_default=text("'0'"),
                    comment='用户状态 0:正常; 1:禁用 ;2:未验证')
    login_time = Column(INTEGER(11),
                        nullable=False,
                        server_default=text("'0'"),
                        comment='登录时间')
    add_time = Column(INTEGER(11),
                      nullable=False,
                      server_default=text("'0'"),
                      comment='添加时间')
    update_time = Column(INTEGER(11),
                         nullable=False,
                         server_default=text("'0'"),
                         comment='更新时间')
    delete_time = Column(INTEGER(11),
                         nullable=False,
                         server_default=text("'0'"),
                         comment='删除时间')
class MAC_RESOURCES_AREA_WASTE_GAS_EMISSION(Base):
    """
    各地区废气排放及处理情况表
    """
    __tablename__ = "MAC_RESOURCES_AREA_WASTE_GAS_EMISSION"

    id = Column(Integer, primary_key=True)
    stat_year = Column(String(4), nullable=False)
    area_code = Column(String(20), nullable=False)
    area_name = Column(String(100), nullable=False)
    SO2_discharged = Column(DECIMAL(20, 4))
    NO_discharged = Column(DECIMAL(20, 4))
    soot_discharged = Column(DECIMAL(20, 4))
    status = Column(TINYINT(display_width=4), default=0)
    addtime = Column(TIMESTAMP, default=datetime.datetime.now)
    modtime = Column(TIMESTAMP)
예제 #7
0
class PaymentHistory(db.Model):
    __table_args__ = ({'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'})
    gmo_credit_id = db.Column(db.Integer,
                              primary_key=True,
                              autoincrement=False)
    gmo_credit_mod_datetime = db.Column(db.DATETIME, primary_key=True)
    payment_datetime = db.Column(db.DATETIME, nullable=False)
    member_id = db.Column(db.VARCHAR(20), nullable=False)
    user_id = db.Column(db.Integer, nullable=False)
    device = db.Column(db.VARCHAR(10), nullable=False, default='Others')
    project_id = db.Column(db.Integer, nullable=False)
    item_id = db.Column(db.Integer, nullable=False)
    payment_type = db.Column(db.Integer, nullable=False)
    changed_status = db.Column(TINYINT(1), nullable=False, default=0)
    amount = db.Column(db.Integer, nullable=False)
    reg_datetime = db.Column(db.DATETIME, default=datetime.now)
예제 #8
0
class Books(Base):
    __tablename__ = "books"
    id_ = Column('id', Integer, primary_key=True)
    name = Column('name', String(255))
    volume = Column('volume', String(255))
    author = Column('author', String(255))
    publisher = Column('publisher', String(255))
    memo = Column('memo', Text())
    create_date = Column('create_date',
                         DATETIME,
                         server_default=text('NOW()'),
                         nullable=False)
    delFlg = Column('del',
                    TINYINT(4),
                    server_default=text('0'),
                    nullable=False)
예제 #9
0
파일: models.py 프로젝트: nesp-tsr3-1/tsx
class T2ProcessedSighting(Base):
    __tablename__ = 't2_processed_sighting'
    __table_args__ = (Index('survey_id_taxon_id', 'survey_id', 'taxon_id'), )

    id = Column(Integer, primary_key=True)
    survey_id = Column(ForeignKey('t2_processed_survey.id',
                                  ondelete='CASCADE'),
                       nullable=False)
    taxon_id = Column(ForeignKey('taxon.id'), nullable=False, index=True)
    count = Column(Float(asdecimal=True), nullable=False)
    unit_id = Column(ForeignKey('unit.id'), nullable=False, index=True)
    pseudo_absence = Column(TINYINT(1), nullable=False)

    survey = relationship('T2ProcessedSurvey')
    taxon = relationship('Taxon')
    unit = relationship('Unit')
class WalletEosGatherModel(BaseModel):
    __tablename__ = "wallet_eos_gather"
    sub_index = Column(BigInteger, nullable=False, comment="归集账户 子钱包索引")
    sub_public_address = Column(String(128), unique=True, nullable=False, server_default="", comment="归集账户 子地址")
    change_index = Column(String(255), nullable=False, server_default="", comment="归集账户 change index")
    acct_public_key_aes = Column(String(255), nullable=False, server_default="", comment="归集账户 主公钥AES加密防止以后有多个助记词生成主秘钥同时使用")
    coin_id = Column(String(128), nullable=False, server_default="", comment="归集账户 货币id")
    account_id = Column(String(64), nullable=False, server_default="", comment="归集账户 主账户ID")
    status = Column(TINYINT(1), nullable=False, server_default="1", comment="归集账户 状态")
    amount = Column(Numeric(36, 18), default=get_decimal('0', 18), nullable=False, server_default="0.000000000000000000", comment="地址上的钱")
    amount_change = Column(Numeric(36, 18), default=get_decimal('0', 18), nullable=False, server_default="0.000000000000000000", comment="待找零金额")
    amount_frozen = Column(Numeric(36, 18), default=get_decimal('0', 18), nullable=False, server_default="0.000000000000000000", comment="已支付未确认到账")
    desc = Column(String(255), nullable=False, server_default="", comment="归集账户 描述")

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
예제 #11
0
class BuoyStatusInfo(Base):
    __tablename__ = 'nt_plfbztxxb'
    ID = Column(BigInteger, primary_key=True, autoincrement=True)
    PLFBQZH = Column(Unicode(64), nullable=False)
    GCRQSJ = Column(DateTime)
    JMZT = Column(SMALLINT(unsigned=True))
    ZBWD = Column(DOUBLE)
    DYDY = Column(DOUBLE)
    ZTHGJD = Column(DOUBLE)
    ZTFYJD = Column(DOUBLE)
    ZTFWJD = Column(DOUBLE)
    CXCQW = Column(TINYINT(unsigned=True))
    KMGGLW = Column(TINYINT(unsigned=True))
    ZTSJJSW = Column(TINYINT(unsigned=True))
    ZTSJYXW = Column(TINYINT(unsigned=True))
    GPSSJJSW = Column(TINYINT(unsigned=True))
    GPSJSSJYXW = Column(TINYINT(unsigned=True))
    GPSDWSJYXW = Column(TINYINT(unsigned=True))
    YXJSWXS = Column(TINYINT(unsigned=True))
    JD = Column(DOUBLE)
    WD = Column(DOUBLE)
    __table_args__ = (UniqueConstraint(PLFBQZH,
                                       GCRQSJ,
                                       name="station_sampling_process"), )

    @classmethod
    def get_unique(cls, session, override=False, **fieldnames):
        cache = session._unique_cache = getattr(session, '_unique_cache', {})
        key = (cls, fieldnames['PLFBQZH'], fieldnames['GCRQSJ'])
        o = cache.get(key)
        if o is None:
            if override:
                session.query(cls).filter(
                    cls.PLFBQZH == fieldnames['PLFBQZH'],
                    cls.GCRQSJ == fieldnames['GCRQSJ']).delete()
                o = cls(**fieldnames)
                session.add(o)
            else:
                o = session.query(cls).filter_by(
                    PLFBQZH=fieldnames['PLFBQZH'],
                    GCRQSJ=fieldnames['GCRQSJ']).first()
                if o is None:
                    o = cls(**fieldnames)
                    session.add(o)
            cache[key] = o
예제 #12
0
class MAC_LIFE_EXPECT(Base):
    """
    各地区人口平均预期寿命表
    """
    __tablename__ = "MAC_LIFE_EXPECT"

    id = Column(Integer, primary_key=True)
    stat_year = Column(String(4), nullable=False)
    area_code = Column(String(20), nullable=False)
    area_name = Column(String(100), nullable=False)
    life_expect = Column(DECIMAL(20, 8))
    male_life_expect = Column(DECIMAL(20, 8))
    female_life_expect = Column(DECIMAL(20, 8))
    status = Column(TINYINT(display_width=4), default=0)
    addtime = Column(TIMESTAMP, default=datetime.datetime.now)
    modtime = Column(TIMESTAMP)
예제 #13
0
class FileActionRequest(Base):
    __tablename__ = 'file_action_request'

    id = Column(INTEGER(11), primary_key=True)
    data_product_id = Column(ForeignKey('data_product.id', onupdate='CASCADE'),
                             nullable=False,
                             index=True)
    action_id = Column(ForeignKey('file_action.id', onupdate='CASCADE'),
                       nullable=False,
                       index=True)
    requested_at = Column(DateTime, nullable=False)
    completed_at = Column(DateTime)
    success = Column(TINYINT(1), nullable=False)

    action = relationship('FileAction')
    data_product = relationship('DataProduct')
class NHMInstallationFacility(Base):
    __tablename__ = 'NHM_Installation_Facilities'

    Installation_Description = Column(Text)
    Installation_Short_Name = Column(
        ForeignKey('Infrastructures_Installations.Installation_Short_Name'),
        index=True)
    Facility_ID = Column(Integer, primary_key=True)
    Response_Type = Column(String(255))
    Category_ID = Column(ForeignKey('NHM_Facility_Categories.Category_ID'),
                         index=True)
    Help = Column(Text)
    facility_closed = Column(TINYINT(1))

    NHM_Facility_Category = relationship('NHMFacilityCategory')
    Infrastructures_Installation = relationship('InfrastructuresInstallation')
예제 #15
0
class MAC_AREA_CPI_MONTH(Base):
    """
    分地区居民消费价格指数
    """

    __tablename__ = "MAC_AREA_CPI_MONTH"

    id = Column(Integer, primary_key=True)
    stat_month = Column(String(20), nullable=False)
    area_code = Column(String(20), nullable=False)
    area_name = Column(String(100), nullable=False)
    item_name = Column(String(128), nullable=False)
    item_value = Column(DECIMAL(10, 4))
    status = Column(TINYINT(display_width=4), default=0)
    addTime = Column(TIMESTAMP, default=datetime.datetime.now)
    modTime = Column(TIMESTAMP)
예제 #16
0
class CO2EIIPUBLISHING(Base):
    __tablename__ = "CO2EII_PUBLISHING"
    __table_args__ = (
        Index("SETTLEMENTDATE_2", "SETTLEMENTDATE", "REGIONID", unique=True),
    )

    id = Column(INTEGER(11), primary_key=True)
    CONTRACTYEAR = Column(SMALLINT(6), index=True)
    WEEKNO = Column(TINYINT(4), index=True)
    SETTLEMENTDATE = Column(DateTime, index=True)
    REGIONID = Column(ForeignKey("nemweb_meta.REGIONID.id"), index=True)
    TOTAL_SENT_OUT_ENERGY = Column(DECIMAL(14, 8))
    TOTAL_EMISSIONS = Column(DECIMAL(14, 8))
    CO2E_INTENSITY_INDEX = Column(DECIMAL(5, 4))

    REGIONID1 = relationship("REGIONID")
예제 #17
0
파일: models.py 프로젝트: indimi/indimi
class User(db.Model):
    __tablename__ = f"{Base.DATABASE_TABLE_PREFIX}user"

    user_id = db.Column(INTEGER(10, unsigned=True), primary_key=True)
    login = db.Column(db.String(50), unique=True, nullable=False)
    password = db.Column(db.String(100), nullable=False)
    salt = db.Column(db.String(100), nullable=False)
    name = db.Column(db.String(100), nullable=False)    
    email = db.Column(db.String(255), unique=True, nullable=False)
    website = db.Column(db.String(255), nullable=True)
    timezone = db.Column(db.String(50), nullable=True)
    lastlogin = db.Column(db.TIMESTAMP, nullable=True)
    lastloginattempt = db.Column(db.TIMESTAMP, nullable=True)
    failedloginattempts = db.Column(INTEGER(11), nullable=False, server_default=text("0"))
    remembertoken = db.Column(db.String(100), nullable=True)
    voided = db.Column(TINYINT(1), nullable=False, server_default=text("0"))
예제 #18
0
class MAC_AREA_UNEMPLOY(Base):
    """
    分地区城镇登记失业率
    """

    __tablename__ = "MAC_AREA_UNEMPLOY"

    id = Column(Integer, primary_key=True)
    stat_year = Column(String(4), nullable=False)
    area_code = Column(String(20), nullable=False)
    area_name = Column(String(100), nullable=False)
    unemploy = Column(DECIMAL(20, 4))
    unemploy_rate = Column(DECIMAL(10, 4))
    status = Column(TINYINT(display_width=4), default=0)
    addTime = Column(TIMESTAMP, default=datetime.datetime.now)
    modTime = Column(TIMESTAMP)
예제 #19
0
파일: T.py 프로젝트: logonmy/XX
class QqmusicSong(Base):
    __tablename__ = 'qqmusic_song'
    __table_args__ = (Index('i_', 'id', 'epoch'), )

    id = Column(String(64), primary_key=True, index=True)
    epoch = Column(String(32))
    web_id = Column(BIGINT(22))
    web_mid = Column(String(60))
    rank_list_id = Column(String(32))
    star = Column(BIGINT(20))
    bullet_num = Column(BIGINT(40))
    comment_num = Column(BIGINT(40), server_default=text("'0'"))
    status = Column(TINYINT(4))
    createtime = Column(
        TIMESTAMP,
        server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
예제 #20
0
class MAC_RESOURCES_ECOLOGICAL_ENVIRONMENT(Base):
    """
    生态环境情况信息表
    """
    __tablename__ = "MAC_RESOURCES_ECOLOGICAL_ENVIRONMENT"

    id = Column(Integer, primary_key=True)
    stat_year = Column(String(4), nullable=False)
    forest_area = Column(DECIMAL(20, 4))
    forest_cover_rate = Column(DECIMAL(10, 4))
    man_made_forest_area = Column(DECIMAL(20, 4))
    nature_reserves_num = Column(DECIMAL(20, 4))
    nature_reserves_area = Column(DECIMAL(20, 4))
    status = Column(TINYINT(display_width=4), default=0)
    addtime = Column(TIMESTAMP, default=datetime.datetime.now)
    modtime = Column(TIMESTAMP)
예제 #21
0
class MAC_ECONOMIC_BOOM_IDX(Base):
    """
    宏观经济景气指数
    """

    __tablename__ = "MAC_ECONOMIC_BOOM_IDX"

    id = Column(Integer, primary_key=True)
    stat_month = Column(String(20), nullable=False)
    early_warning_idx = Column(DECIMAL(10, 4))
    consistency_idx = Column(DECIMAL(10, 4))
    leading_idx = Column(DECIMAL(10, 4))
    lagging_idx = Column(DECIMAL(10, 4))
    status = Column(TINYINT(display_width=4), default=0)
    addTime = Column(TIMESTAMP, default=datetime.datetime.now)
    modTime = Column(TIMESTAMP)
예제 #22
0
파일: models.py 프로젝트: chengboliber/User
def get_user_fans_table(user_id):
    shard_id = int(user_id) / constants.DB_USER_RELATION_SHARD_NUM
    table = user_fans_tables.get(shard_id)
    if table is None:
        table = Table('user_fans_%d' % shard_id, meta,
                    Column('id', Integer, primary_key=True),
                    Column('user_id', BigInteger, nullable=False),
                    Column('fans_user_id', BigInteger, nullable=False),
                    Column('created', DateTime, nullable=False),
                    Column('parent_id', BigInteger, nullable=False, server_default="0"),
                    Column('notification', TINYINT(1), nullable=False, default=1),
                    UniqueConstraint('user_id', 'fans_user_id', name='unique_2_user_id'),
                    mysql_engine='InnoDB')
        table.create(checkfirst=True)
        user_fans_tables[shard_id] = table
    return table
예제 #23
0
class DataForm(Base):
    __tablename__ = 'data_forms'

    id = Column(BigInteger, nullable=False, server_default=text("'0'"))
    order_num = Column(BigInteger, server_default=text("'0'"))
    table_name = Column(String(255))
    form_name = Column(String(250), primary_key=True)
    description = Column(Text)
    selected = Column(TINYINT)
    val_start_position = Column(BigInteger, server_default=text("'0'"))
    val_end_position = Column(BigInteger, server_default=text("'0'"))
    elem_code_location = Column(String(255))
    sequencer = Column(String(50))
    entry_mode = Column(TINYINT(2),
                        nullable=False,
                        server_default=text("'00'"))
예제 #24
0
class MAC_FISCAL_CENTRAL_REVENUE_YEAR(Base):
    """
    中央和地方财政主要收入项目情况表(年度)
    """
    __tablename__ = "MAC_FISCAL_CENTRAL_REVENUE_YEAR"

    id = Column(Integer, primary_key=True)
    stat_year = Column(String(4), nullable=False)
    item_id = Column(String(10), nullable=False)
    item_name = Column(String(128), nullable=False)
    revenue = Column(DECIMAL(20, 4))
    central_revenue = Column(DECIMAL(20, 4))
    local_revenue = Column(DECIMAL(20, 4))
    status = Column(TINYINT(display_width=4), default=0)
    addtime = Column(TIMESTAMP, default=datetime.datetime.now)
    modtime = Column(TIMESTAMP)
예제 #25
0
파일: models.py 프로젝트: nesp-tsr3-1/tsx
class T2Sighting(Base):
    __tablename__ = 't2_sighting'

    id = Column(Integer, primary_key=True)
    survey_id = Column(ForeignKey('t2_survey.id', ondelete='CASCADE'),
                       nullable=False,
                       index=True)
    taxon_id = Column(ForeignKey('taxon.id'), nullable=False, index=True)
    count = Column(Float(asdecimal=True))
    unit_id = Column(ForeignKey('unit.id'), index=True)
    breeding = Column(TINYINT(1))
    comments = Column(Text)

    survey = relationship('T2Survey')
    taxon = relationship('Taxon')
    unit = relationship('Unit')
예제 #26
0
파일: tables.py 프로젝트: vicb/FAI-Airscore
class TblLadderSeason(BaseModel):
    __tablename__ = 'tblLadderSeason'

    ladder_id = Column(ForeignKey('tblLadder.ladder_id'),
                       nullable=False,
                       index=True,
                       primary_key=True)
    season = Column(INTEGER(6), nullable=False, index=True)
    active = Column(TINYINT(1), server_default=text("'1'"))
    cat_id = Column(ForeignKey('tblClassification.cat_id'),
                    nullable=False,
                    index=True)
    overall_validity = Column(Enum('all', 'ftv', 'round'),
                              nullable=False,
                              server_default=text("'ftv'"))
    validity_param = Column(Float, nullable=False)
예제 #27
0
파일: models.py 프로젝트: nesp-tsr3-1/tsx
class T2UltrataxonSighting(Base):
    __tablename__ = 't2_ultrataxon_sighting'

    sighting_id = Column(ForeignKey('t2_sighting.id', ondelete='CASCADE'),
                         primary_key=True,
                         nullable=False)
    taxon_id = Column(ForeignKey('taxon.id'),
                      primary_key=True,
                      nullable=False,
                      index=True)
    range_id = Column(ForeignKey('range.id'), nullable=False, index=True)
    generated_subspecies = Column(TINYINT(1), nullable=False)

    range = relationship('Range')
    sighting = relationship('T2Sighting')
    taxon = relationship('Taxon')
예제 #28
0
class EventsNotificationRules(db.Model):
    __tablename__ = 'events_notification_rules'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    notification_id = db.Column(TINYINT(11), primary_key=True)
    # rule_condition = db.Column(db.Integer, db.ForeignKey('events_notification_conditions_data.condition_id'), primary_key=True)
    rule_condition = db.Column(db.Integer, primary_key=True)
    rule_operator = db.Column(db.Text)
    rule_value = db.Column(db.Text)

    notify_data = db.relationship('EventsNotificationData')
    conditions = db.relationship('EventsNotificationConditions')

    def __repr__(self):
        return '[notification_id] %r, [rule_condition] %r, [rule_operator] %r, [rule_value] %r, [notify_data] %r' \
               % (self.notification_id,self.rule_condition,self.rule_operator,self.rule_value,self.notify_data)
예제 #29
0
class MAC_RESOURCES_WATER_RESOURCES_YEAR(Base):
    """
    全国水资源量年度信息表
    """
    __tablename__ = "MAC_RESOURCES_WATER_RESOURCES_YEAR"

    id = Column(Integer, primary_key=True)
    stat_year = Column(String(4), nullable=False)
    total_amount = Column(DECIMAL(20, 4))
    surface = Column(DECIMAL(20, 4))
    ground = Column(DECIMAL(20, 4))
    duplicated_measurement = Column(DECIMAL(10, 4))
    per_amount = Column(DECIMAL(20, 4))
    status = Column(TINYINT(display_width=4), default=0)
    addtime = Column(TIMESTAMP, default=datetime.datetime.now)
    modtime = Column(TIMESTAMP)
class MAC_TRADE_VALUE_LOCATION_YEAR(Base):
    """
    各地区按经营单位所在地分货物进出口总额表(年度)
    """
    __tablename__ = "MAC_TRADE_VALUE_LOCATION_YEAR"

    id = Column(Integer, primary_key=True)
    stat_year = Column(String(4), nullable=False)
    area_code = Column(String(20), nullable=False)
    area_name = Column(String(100), nullable=False)
    total_dollar = Column(DECIMAL(20, 4))
    export_dollar = Column(DECIMAL(20, 4))
    import_dollar = Column(DECIMAL(20, 4))
    status = Column(TINYINT(display_width=4), default=0)
    addTime = Column(TIMESTAMP, default=datetime.datetime.now)
    modTime = Column(TIMESTAMP)