Example #1
0
class ObservingSystemInstallation(Base):
    __tablename__ = 'observing_system_installation'
    __table_args__ = (CheckConstraint('  SRC_ID >= 0'), )

    ob_sys_intl_id = Column(NUMERIC(6, 0, False),
                            primary_key=True,
                            comment=' Unique number for each record')
    ob_sys_vrsn_id = Column(
        NUMERIC(6, 0, False),
        nullable=False,
        index=True,
        comment=' Unique number for observing system version')
    src_id = Column(ForeignKey('source.src_id'),
                    nullable=False,
                    index=True,
                    comment=' Unique number for station')
    ob_sys_intl_bgn_date = Column(
        DateTime,
        nullable=False,
        comment=' Start date of installation of observing sys at station')
    ob_sys_intl_end_date = Column(
        DateTime,
        nullable=False,
        comment=' End date of installation of observing sys at station')

    src = relationship('Source')
Example #2
0
class DeploymentDetail(Base):
    __tablename__ = 'deployment_detail'
    __table_args__ = {
        'comment':
        'The details of attributes associated with deployments of equipment. related to the deplyment and the deployment attribute tables.'
    }

    depl_attr_id = Column(NUMERIC(6, 0, False),
                          primary_key=True,
                          nullable=False,
                          index=True,
                          comment=' Deployment attribute unique identifier')
    deployment_id = Column(ForeignKey('deployment.deployment_id'),
                           primary_key=True,
                           nullable=False,
                           index=True,
                           comment=' Deployment record unique identifier')
    depl_attr_bgn_date = Column(
        DateTime,
        primary_key=True,
        nullable=False,
        comment=' Begin date for which attribute value is valid')
    depl_dtl_val = Column(NUMERIC(4, 0, False),
                          nullable=False,
                          comment=' Value associated with attribute')
    depl_attr_end_date = Column(
        DateTime,
        nullable=False,
        comment=' End date for which attribute value is valid')

    deployment = relationship('Deployment')
Example #3
0
class RawContract(Base):  # type: ignore
    __tablename__ = 'raw_contracts'

    id = Column(Integer, primary_key=True, autoincrement=True)
    uuid = Column(String(255))
    vendorName = Column(TEXT, nullable=True)
    referenceNumber = Column(TEXT, nullable=True)
    contractDate = Column(TEXT, nullable=True)
    description = Column(TEXT, nullable=True)
    extraDescription = Column(TEXT, nullable=True)
    contractPeriodStart = Column(TEXT, nullable=True)
    contractPeriodEnd = Column(TEXT, nullable=True)
    startYear = Column(INTEGER, nullable=True)
    endYear = Column(INTEGER, nullable=True)
    deliveryDate = Column(TEXT, nullable=True)
    originalValue = Column(NUMERIC(20, 2), nullable=True)
    contractValue = Column(NUMERIC(20, 2), nullable=True)
    comments = Column(TEXT, nullable=True)
    ownerAcronym = Column(TEXT, nullable=True)
    sourceYear = Column(INTEGER, nullable=True)
    sourceQuarter = Column(INTEGER, nullable=True)
    sourceFiscal = Column(TEXT, nullable=True)
    sourceFilename = Column(TEXT, nullable=True)
    sourceURL = Column(TEXT, nullable=True)
    objectCode = Column(TEXT, nullable=True)
    vendorClean = Column(TEXT, nullable=True)
Example #4
0
class InspectionDetail(Base):
    __tablename__ = 'inspection_detail'
    __table_args__ = {
        'comment':
        'Related to the inspection table and provides the inspection details (the results) of the inspections carried out.'
    }

    insp_detl_id = Column(NUMERIC(8, 0, False),
                          primary_key=True,
                          comment=' Unique identifier of record')
    inspection_item_id = Column(
        NUMERIC(5, 0, False),
        nullable=False,
        comment=' Unique identifier of inspection item')
    insp_detl_rslt_txt = Column(
        VARCHAR(1000),
        nullable=False,
        comment=' Result of the inspection item for this inspection')
    deployment_id = Column(ForeignKey('deployment.deployment_id'),
                           comment=' Deployment which this item refers to')
    inspection_id = Column(ForeignKey('inspection.inspection_id'),
                           nullable=False,
                           comment=' Equipment which this item refers to')

    deployment = relationship('Deployment')
    inspection = relationship('Inspection')
Example #5
0
class Equipment(Base):
    __tablename__ = 'equipment'
    __table_args__ = {
        'comment':
        'The details of the items of equipment deployed at a station. Related by the equipment ID to the deployment table. The EQPT_PRCT_DATE and EQPT_DSPL_DATE are for equipment procurement and equipment disposal dates respectively.\nHowever, they are more often used to record calibration validity start and end dates respectively.'
    }

    equipment_id = Column(
        NUMERIC(6, 0, False),
        primary_key=True,
        comment=' Unique identifier for piece of equipment in Metadata')
    equipment_type_id = Column(NUMERIC(6, 0, False),
                               nullable=False,
                               comment=' Unique identifier for equipment type')
    manufacturer_name = Column(VARCHAR(28),
                               nullable=False,
                               comment=' Name of equipment manufacturer')
    manufacturer_sn_txt = Column(
        VARCHAR(24),
        nullable=False,
        comment=' Manufacturer serial number or SI database Sensor_serial_no ')
    met_ref_txt = Column(
        VARCHAR(24),
        comment=' Met Office reference number or SI database Asset_id')
    eqpt_prct_date = Column(
        DateTime, comment='Equipment procurement date, or date of calibration')
    equipment_cost = Column(NUMERIC(6, 2, True), comment=' Cost of equipment')
    eqpt_dspl_date = Column(
        DateTime,
        comment='Equipment disposal date, or date calibration expires.')
    eqpt_dspl_rmrk = Column(VARCHAR(200), comment=' Equipment disposal remark')
    eqpt_last_updated_date = Column(
        DateTime,
        comment='Date at which this equipment was inserted or last updated')
Example #6
0
class Contract(Base):  # type: ignore
    __tablename__ = 'contracts'

    id = Column(Integer, primary_key=True, autoincrement=True)
    uuid = Column(String(255))
    vendor_name = Column(TEXT, nullable=True)
    reference_number = Column(TEXT, nullable=True)
    contract_date = Column(Date, nullable=False)
    contract_period_start = Column(Date, nullable=False)
    contract_period_end = Column(Date, nullable=False)
    contract_value = Column(NUMERIC(20, 2), nullable=True)
    department = Column(TEXT, nullable=True)
    source_fiscal = Column(Date, nullable=True)
    object_code = Column(TEXT, nullable=True)
    reporting_period_start = Column(Date, nullable=False)
    reporting_period_end = Column(Date, nullable=False)
    reporting_period_value = Column(NUMERIC(20, 2), nullable=False)

    def __repr__(self):
        data_string = ', '.join([f'{key}={getattr(self, key)}'
                                 for key in self.metadata.tables[self.__tablename__].columns.keys()])
        return f'<Contract({data_string})>'

    def __eq__(self, other):
        if not isinstance(other, Contract):
            return False
        return all([getattr(self, key) == getattr(other, key)
                    for key in self.metadata.tables[self.__tablename__].columns.keys()])
Example #7
0
class EqptCalibCoeff(Base):
    __tablename__ = 'eqpt_calib_coeff'

    calib_coeff_msrt_id = Column(NUMERIC(6, 0, False), primary_key=True)
    eqpt_type_calib_coeff_id = Column(NUMERIC(6, 0, False), nullable=False)
    eqpt_calib_id = Column(ForeignKey('equipment_calibration.eqpt_calib_id'),
                           nullable=False)
    calib_coeff_val = Column(NUMERIC(10, 2, True))

    eqpt_calib = relationship('EquipmentCalibration')
Example #8
0
class StationReportElement(Base):
    __tablename__ = 'station_report_element'

    stn_rpt_elem_id = Column(NUMERIC(6, 0, False), primary_key=True)
    id = Column(VARCHAR(8))
    id_type = Column(VARCHAR(4), nullable=False)
    src_cap_bgn_date = Column(DateTime, nullable=False)
    met_domain_name = Column(VARCHAR(8), nullable=False)
    met_element_id = Column(NUMERIC(5, 0, False), nullable=False)
    rpt_elem_bgn_date = Column(DateTime, nullable=False)
    rpt_elem_end_date = Column(DateTime, nullable=False)
Example #9
0
class BoardCommon2(Base):
    __tablename__ = "board_common"
    __table_args__ = {'comment': '게시판 공통'}

    BOARD_COMMON_ID = Column(VARCHAR(255),
                             primary_key=True,
                             comment='게시글 고유 식별 번호')
    BOARD_ID = Column(VARCHAR(50), nullable=False, comment='게시판 고유 식별 번호')
    USER_NO = Column(VARCHAR(255), comment='사용자 고유 식별 번호')
    BOARD_COMMON_TITLE = Column(VARCHAR(50), comment='게시글 제목')
    BOARD_COMMON_CONTENT = Column(VARCHAR(50), comment='게시글 내용')
    BOARD_COMMON_REGDATE = Column(DATETIME, comment='게시글 등록일')
    BOARD_COMMON_MODIDATE = Column(DATETIME, comment='게시글 수정일')
    BOARD_COMMON_COUNT = Column(NUMERIC(11), comment='게시글 조회수')
    BOARD_COMMON_DEL = Column(BOOLEAN, comment='게시글 삭제 상태')
    BOARD_COMMON_DELDATE = Column(DATETIME, comment='게시글 삭제일')
    BOARD_COMMON_NO = Column(Integer, autoincrement=True, comment='게시글 번호')
    BOARD_COMMON_PNO = Column(NUMERIC(11), comment='게시글 부모번호')

    def __init__(self, boardCommonId, **kwargs):
        self.BOARD_COMMON_ID = boardCommonId

        self.BOARD_ID = kwargs.get('BOARD_ID', None)
        self.USER_NO = kwargs.get('USER_NO', None)
        self.BOARD_COMMON_TITLE = kwargs.get('BOARD_COMMON_TITLE', None)
        self.BOARD_COMMON_CONTENT = kwargs.get('BOARD_COMMON_CONTENT', None)
        self.BOARD_COMMON_REGDATE = kwargs.get('BOARD_COMMON_REGDATE', None)
        self.BOARD_COMMON_MODIDATE = kwargs.get('BOARD_COMMON_MODIDATE', None)
        self.BOARD_COMMON_COUNT = kwargs.get('BOARD_COMMON_COUNT', None)
        self.BOARD_COMMON_DEL = kwargs.get('BOARD_COMMON_DEL', None)
        self.BOARD_COMMON_DELDATE = kwargs.get('BOARD_COMMON_DELDATE', None)
        self.BOARD_COMMON_NO = kwargs.get('BOARD_COMMON_NO', None)
        self.BOARD_COMMON_PNO = kwargs.get('BOARD_COMMON_PNO', None)

    def __repr__(self):
        return "{'BOARD_COMMON_ID' : '%s', \
        'BOARD_ID' : '%s', \
        'USER_NO' : '%s', \
        'BOARD_COMMON_TITLE' : '%s', \
        'BOARD_COMMON_CONTENT' : '%s', \
        'BOARD_COMMON_REGDATE' : '%s', \
        'BOARD_COMMON_MODIDATE' : '%s', \
        'BOARD_COMMON_COUNT' : '%s', \
        'BOARD_COMMON_DEL' : '%s', \
        'BOARD_COMMON_DELDATE' : '%s', \
        'BOARD_COMMON_NO' : '%s', \
        'BOARD_COMMON_PNO' : '%s'}" % (
            self.BOARD_COMMON_ID, self.BOARD_ID, self.USER_NO,
            self.BOARD_COMMON_TITLE, self.BOARD_COMMON_CONTENT,
            self.BOARD_COMMON_REGDATE, self.BOARD_COMMON_MODIDATE,
            self.BOARD_COMMON_COUNT, self.BOARD_COMMON_DEL,
            self.BOARD_COMMON_DELDATE, self.BOARD_COMMON_NO,
            self.BOARD_COMMON_PNO)
Example #10
0
class Weight(Base):
    __tablename__ = 'weight'
    ndb_no = Column(
        String(5),
        # ForeignKey('food_description.ndb_no'),
        nullable=False,
        primary_key=True)
    sequence_no = Column(String(2), nullable=False, primary_key=True)
    unit_amount = Column(NUMERIC(5, 2), nullable=False)
    measurement_description = Column(String(84), nullable=False)
    gram_weight = Column(NUMERIC(7, 1), nullable=False)
    num_data_points = Column(Integer, nullable=True)
    std_deviation = Column(NUMERIC(7, 3), nullable=True)
Example #11
0
class Product(Base):
    __tablename__ = 'product'
    id = Column(Integer, primary_key=True, nullable=False)
    barcode = Column(VARCHAR(64), nullable=False)
    code = Column(VARCHAR(64), nullable=False)
    name = Column(VARCHAR(128))
    ppn_rate = Column(NUMERIC(16, 2), default=0, nullable=False)
    price = Column(NUMERIC(16, 2), default=0, nullable=False)
    sellable = Column(BOOLEAN, default=False, nullable=False)
    active = Column(BOOLEAN, default=False, nullable=False)

    def __repr__(self):
        return "<Product(code='%s',name='%s',price='%s')>" % (
            self.code, self.name, self.price)
Example #12
0
class StationObserver(Base):
    __tablename__ = 'station_observer'
    __table_args__ = (CheckConstraint('  SRC_ID >= 0'), )

    observer_id = Column(NUMERIC(6, 0, False),
                         primary_key=True,
                         nullable=False,
                         index=True,
                         comment=' Unique identifier of observer')
    src_id = Column(ForeignKey('source.src_id'),
                    primary_key=True,
                    nullable=False,
                    index=True,
                    comment=' Unique identifier of station')
    stn_obsr_bgn_date = Column(
        DateTime,
        primary_key=True,
        nullable=False,
        comment=' Date at which observer started at station')
    stn_obsr_end_date = Column(
        DateTime,
        nullable=False,
        comment=' Date at which observer ended at station')
    observer_role_code = Column(
        CHAR(4),
        nullable=False,
        index=True,
        comment=' Code describing the role of the observer at the station')

    src = relationship('Source')
Example #13
0
class SystemIps(BaseModel):
    '''
    ip信息
    '''

    __tablename__ = 'system_ips'

    def __init__(self, ip, **kwargs):
        BaseModel.__init__(self, **kwargs)
        self.ipv4 = ip
        self.ip = self.ip_to_int(ip)

    id = Column(INT, primary_key=True)
    ip = Column(NUMERIC(200), nullable=False)
    ipv4 = Column(VARCHAR(200), default='', nullable=False)
    port_info = Column(VARCHAR(5000), default='', nullable=False)
    web_info = Column(VARCHAR(500), default='', nullable=False)
    create_time = Column(DateTime)
    sync_time = Column(DateTime)

    def get_ip(self):
        if not self.ip:
            return None

        else:
            return str(ipaddress.IPv4Address(self.ip))

    @classmethod
    def ip_to_int(self, ip):
        return int(ipaddress.IPv4Address(unicode(ip)))
Example #14
0
class Inspection(Base):
    __tablename__ = 'inspection'
    __table_args__ = (CheckConstraint('  SRC_ID >= 0'), {
        'comment':
        'Provides a record of inspections carried out at stations and related to the midas.source table'
    })

    inspection_id = Column(NUMERIC(6, 0, False),
                           primary_key=True,
                           comment=' Unique identifier for the inspection')
    src_id = Column(ForeignKey('source.src_id'),
                    nullable=False,
                    index=True,
                    comment=' Unique identifier for the station')
    inspection_date = Column(DateTime,
                             nullable=False,
                             comment=' Date of inspection')
    inspectors_name = Column(VARCHAR(70),
                             nullable=False,
                             comment=' Name of inspector')
    review_date = Column(
        DateTime, comment=' Date on which inspection should be reviewed')
    inspection_remark = Column(VARCHAR(700), comment=' Remark on inspection')

    src = relationship('Source')
Example #15
0
class SystemEvents(BaseModel):
    """事件"""

    __tablename__ = 'system_events'

    def __init__(self, ip, **kwargs):
        BaseModel.__init__(self, **kwargs)
        self.ip = self.ip_to_int(ip)
        self.ipv4 = ip

    id = Column(INT, primary_key=True)
    ip = Column(NUMERIC(200), nullable=False)
    ipv4 = Column(VARCHAR(200), default='', nullable=False)
    domain = Column(VARCHAR(64), nullable=False)
    state = Column(INT, default=0)
    type_id = Column(INT, default=0)
    create_time = Column(DateTime)
    finish_time = Column(DateTime)
    is_delete = Column(INT, default=0)

    def get_ip(self):
        if not self.ip:
            return None

        else:
            return str(ipaddress.IPv4Address(self.ip))

    @classmethod
    def ip_to_int(self, ip):
        return int(ipaddress.IPv4Address(unicode(ip)))
Example #16
0
class StationAuthorityHistory(Base):
    __tablename__ = 'station_authority_history'
    __table_args__ = (CheckConstraint('  SRC_ID >= 0'), )

    authority_id = Column(
        NUMERIC(6, 0, False),
        primary_key=True,
        nullable=False,
        comment=' Foreign key to attribute in the AUTHORITY table')
    src_id = Column(ForeignKey('source.src_id'),
                    primary_key=True,
                    nullable=False,
                    comment=' Foreign key to attribute in the SOURCE table')
    stn_auth_bgn_date = Column(
        DateTime,
        primary_key=True,
        nullable=False,
        comment=' Start date of relationship between station and authority')
    stn_auth_end_date = Column(
        DateTime,
        nullable=False,
        comment=' End date of relationship between station and authority')
    auth_hist_rmrk = Column(VARCHAR(200), comment=' Remark on relationship')

    src = relationship('Source')
Example #17
0
class CelestialBody(Base):
    """Celestial body that can block communications (edges) in a celestial graph
    """
    __tablename__ = 'celestial_bodies'

    id = Column(Integer, primary_key=True)
    _position_binary = Column(BINARY, nullable=False)
    size = Column(NUMERIC(asdecimal=False), nullable=False)
    cel_graph_id = Column(Integer,
                          ForeignKey("celestial_graph.id"),
                          nullable=False)
    cel_graph = relationship("CelestialGraph",
                             back_populates="celestial_bodies")

    @property
    def position(self):
        return self._position

    @position.setter
    def position(self, value: np.ndarray):
        self._position_binary = value.dumps()
        self._position = value

    def __init__(self, position: Union[list, np.ndarray],
                 size: Union[int, float,
                             np.float], cel_graph: "CelestialGraph"):
        self.position = np.array(position)
        self.size = size
        self.cel_graph = cel_graph

    @reconstructor
    def _reconstructor(self):
        self._position = np.loads(self._position_binary)
        self.size = float(self.size)
Example #18
0
class FoodDescription(Base):
    """postgres table holding food description information"""
    __tablename__ = 'food_description'
    ndb_no = Column(String(5), nullable=False, primary_key=True)
    foodgroup_code = Column(String(4), nullable=False)
    long_description = Column(String(200), nullable=False)
    short_description = Column(String(60), nullable=False)
    common_name = Column(String(100), nullable=True)
    manufacturer_name = Column(String(100))
    survey = Column(String(1))
    reference_description = Column(String(135))
    refuse = Column(Integer)
    scientific_name = Column(String(65))
    n_factor = Column(NUMERIC(4, 2))
    pro_factor = Column(NUMERIC(4, 2))
    fat_factor = Column(NUMERIC(4, 2))
    cho_factor = Column(NUMERIC(4, 2))
Example #19
0
def test_create_table_basic3():
    table_object = create_table(df,
                                'test_table_create2',
                                engine,
                                primary_key=['a'],
                                nvarchar_columns=['e'],
                                non_nullable_columns=['d'],
                                base_float_type=NUMERIC(3, 5),
                                create=True)
Example #20
0
class ThesesAuthors(Base):
    __tablename__ = "AutorzyPracy"

    id_student = Column(VARCHAR(10), primary_key=True)
    id_praca = Column(SMALLINT, primary_key=True)
    ocenaKoncowa = Column(NUMERIC(2, 1))

    def __repr__(self):
        return f"<{self.__tablename__}(id_student={self.id_student}, id_praca={self.id_praca}, " \
            f"ocenaKoncowa={self.ocenaKoncowa})>"
Example #21
0
class Request(BaseObj):
    __tablename__ = 'syn-flood'

    ID = Column(INTEGER, primary_key=True)
    src_mac = Column(CHAR(17))
    dst_mac = Column(CHAR(17))
    src_ip = Column(CHAR(15))
    dst_ip = Column(CHAR(15))
    prot_ip = Column(VARCHAR(10))
    is_syn = Column(NUMERIC(1))
    time = Column(DATETIME)
Example #22
0
class User(db.Model):
    __tablename__ = 'In'

    key = Column(VARCHAR, primary_key=True)
    place_name = Column(VARCHAR(100))
    admin_name1 = Column(VARCHAR(100))
    latitude = Column(NUMERIC(9, 6))
    longitude = Column(NUMERIC(9, 6))

    def __init__(self, key, place_name, admin_name1, latitude, longitude):
        self.key = key
        self.place_name = place_name
        self.admin_name1 = admin_name1
        self.latitude = latitude
        self.longitude = longitude

    def __repr__(self):
        """"""
        return "<User - '%s': '%s' - '%s'>" % (self.key, self.place_name,
                                               self.admin_name1)
Example #23
0
class PosSale(Base):
    __tablename__ = 'pos_sale'
    id = Column(Integer,
                Sequence('user_id_seq'),
                primary_key=True,
                nullable=False)
    session_id = Column(Integer)
    customer_id = Column(Integer)
    state = Column(VARCHAR(32), nullable=False, default='Draft')
    info = Column(VARCHAR(256))
    cust_disc_rate = Column(NUMERIC(16, 2), nullable=False, default=0)
    tstamp = Column(TIMESTAMP(0), nullable=False)
Example #24
0
class ObservingSchedule(Base):
    __tablename__ = 'observing_schedule'
    __table_args__ = (Index('c_obs_unq',
                            'stn_rpt_elem_id',
                            'ob_schd_bgn_date',
                            'ob_schd_end_date',
                            'year_date_bgn',
                            'year_date_end',
                            'week_day_bgn',
                            'week_day_end',
                            'time_of_day_bgn',
                            'time_of_day_end',
                            'observing_interval',
                            'public_holiday_flag',
                            unique=True), )

    ob_schd_id = Column(NUMERIC(6, 0, False),
                        primary_key=True,
                        comment=' Unique number of the record')
    stn_rpt_elem_id = Column(
        ForeignKey('station_report_element.stn_rpt_elem_id',
                   ondelete='CASCADE'),
        nullable=False,
        comment=' Unique identifier of the element for the station')
    ob_schd_bgn_date = Column(DateTime,
                              nullable=False,
                              comment=' Start date of record')
    ob_schd_end_date = Column(DateTime,
                              nullable=False,
                              comment=' End date of record')
    year_date_bgn = Column(
        CHAR(5),
        nullable=False,
        comment=' First month/year of report (format mm/yy)')
    year_date_end = Column(CHAR(5),
                           nullable=False,
                           comment=' Last month/year of report (format mm/yy)')
    week_day_bgn = Column(NUMERIC(1, 0, False),
                          nullable=False,
                          comment=' First day of week of report')
    week_day_end = Column(NUMERIC(1, 0, False),
                          nullable=False,
                          comment=' Last day of week of report')
    time_of_day_bgn = Column(NUMERIC(4, 0, False),
                             nullable=False,
                             comment=' First time of day of report')
    time_of_day_end = Column(NUMERIC(4, 0, False),
                             nullable=False,
                             comment=' Last time of day of report')
    observing_interval = Column(
        NUMERIC(4, 0, False),
        nullable=False,
        comment=' Number of minutes between each report')
    public_holiday_flag = Column(
        CHAR(1),
        nullable=False,
        comment=' T or F. Shows whether the report comes in on a bank holiday')
    ob_schd_rmrk = Column(VARCHAR(200), comment=' Remark for the record')

    stn_rpt_elem = relationship('StationReportElement')
Example #25
0
class Messages(Base):
    __tablename__ = 'messages'
    __table_args__ = {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'}

    message_id = Column(VARCHAR(255), primary_key=True)
    mailing_list_url = Column(VARCHAR(255),
                              ForeignKey('mailing_lists.mailing_list_url',
                                         onupdate='CASCADE',
                                         ondelete='CASCADE'),
                              primary_key=True)
    mailing_list = Column(VARCHAR(255))
    first_date = Column(DateTime)
    first_date_tz = Column(NUMERIC(11))
    arrival_date = Column(DateTime)
    arrival_date_tz = Column(NUMERIC(11))
    subject = Column(VARCHAR(1024))
    message_body = Column(MediumText())
    is_response_of = Column(VARCHAR(255), index=True)
    mail_path = Column(TEXT)

    def __repr__(self):
        return u"<Messages(message_id='{0}', " \
               "mailing_list_url='{1}', " \
               "mailing_list='{2}', " \
               "first_date='{3}', first_date_tz='{4}', " \
               "arrival_date='{5}', arrival_date_tz='{6}', " \
               "subject='{7}', message_body='{8}', " \
               "is_response_of='{9}', " \
               "mail_path='{10}')>".format(self.message_id,
                                           self.mailing_list_url,
                                           self.mailing_list,
                                           self.first_date,
                                           self.first_date_tz,
                                           self.arrival_date,
                                           self.arrival_date_tz,
                                           self.subject,
                                           self.message_body,
                                           self.is_response_of,
                                           self.mail_path)
Example #26
0
class Customer(Base):
    __tablename__ = 'customer'
    id = Column(Integer, primary_key=True, nullable=False)
    member_no = Column(VARCHAR(64), unique=True)
    name = Column(VARCHAR(64))
    disc_rate = Column(NUMERIC(16, 2), nullable=False, default=0)
    active = Column(BOOLEAN, default=False, nullable=False)
    is_cust = Column(BOOLEAN, default=False, nullable=False)
    address = Column(VARCHAR(256))

    def __repr__(self):
        return "Customer(member_no='%s', name='%s', address='%s')>" % (
            self.member_no, self.name, self.address)
Example #27
0
class SrcCapabilityNodatum(Base):
    __tablename__ = 'src_capability_nodata'
    __table_args__ = (
        CheckConstraint("SUBSTR(rcpt_method_name,1,8) = 'ID XREF '"),
        CheckConstraint('data_retention_period >= 0000'),
        CheckConstraint('first_online_ob_yr BETWEEN 1738 AND 3999'),
        CheckConstraint('rec_st_ind >= 0001'),
        CheckConstraint(
            "src_cap_bgn_date BETWEEN TO_DATE('16770101','YYYYMMDD') AND TO_DATE('39991231','YYYYMMDD')"
        ), CheckConstraint('src_cap_end_date >= src_cap_bgn_date'),
        CheckConstraint('src_cap_end_date >= src_cap_bgn_date'),
        CheckConstraint(
            "src_cap_end_date BETWEEN TO_DATE('01011677','DDMMYYYY') AND TO_DATE('31123999','DDMMYYYY')"
        ),
        Index('c_scnd_unq',
              'id',
              'id_type',
              'met_domain_name',
              'src_cap_end_date',
              unique=True))

    id = Column(VARCHAR(8), primary_key=True, nullable=False)
    id_type = Column(VARCHAR(4), primary_key=True, nullable=False)
    met_domain_name = Column(VARCHAR(8), primary_key=True, nullable=False)
    src_cap_bgn_date = Column(DateTime, primary_key=True, nullable=False)
    src_id = Column(ForeignKey('source.src_id'), nullable=False)
    rec_st_ind = Column(NUMERIC(4, 0, False), nullable=False)
    prime_capability_flag = Column(Enum('T', 'F',
                                        name="prime_capability_flag"),
                                   nullable=False)
    src_cap_end_date = Column(DateTime)
    first_online_ob_yr = Column(NUMERIC(4, 0, False))
    db_segment_name = Column(VARCHAR(12))
    rcpt_method_name = Column(VARCHAR(20))
    data_retention_period = Column(NUMERIC(3, 0, False))
    comm_mthd_id = Column(NUMERIC(6, 0, False))

    src = relationship('Source')
Example #28
0
class Review(Base):
    __tablename__ = "Recenzja"

    id_recenzja = Column(SMALLINT, primary_key=True)
    id_praca = Column(SMALLINT, nullable=False)
    id_recenzujacy = Column(SMALLINT, nullable=False)
    ocena = Column(NUMERIC(2, 1))
    tekstRecenzji = Column(VARCHAR("max"))
    dataWystawienia = Column(DATETIME)

    def __repr__(self):
        return f"<{self.__tablename__}(id_recenzja={self.id_recenzja}, id_praca={self.id_praca}, " \
            f"id_recenzujacy={self.id_recenzujacy}, ocena={self.ocena}, tekstRecenzji={self.tekstRecenzji}, " \
            f"dataWystawienia={self.dataWystawienia})>"
Example #29
0
    def test_type_reflection(self):
        metadata = self.metadata

        # (ask_for, roundtripped_as_if_different)

        specs = [
            (String(), String()),
            (String(1), String(1)),
            (String(3), String(3)),
            (Text(), Text()),
            (Unicode(), String()),
            (Unicode(1), String(1)),
            (Unicode(3), String(3)),
            (UnicodeText(), Text()),
            (CHAR(1), ),
            (CHAR(3), CHAR(3)),
            (NUMERIC, NUMERIC()),
            (NUMERIC(10, 2), NUMERIC(10, 2)),
            (Numeric, NUMERIC()),
            (Numeric(10, 2), NUMERIC(10, 2)),
            (DECIMAL, DECIMAL()),
            (DECIMAL(10, 2), DECIMAL(10, 2)),
            (INTEGER, INTEGER()),
            (BIGINT, BIGINT()),
            (Float, Float()),
            (NUMERIC(), ),
            (TIMESTAMP, TIMESTAMP()),
            (DATETIME, DATETIME()),
            (DateTime, DateTime()),
            (DateTime(), ),
            (DATE, DATE()),
            (Date, Date()),
            (TIME, TIME()),
            (Time, Time()),
            (BOOLEAN, BOOLEAN()),
            (Boolean, Boolean()),
            ]
        columns = [Column('c%i' % (i + 1), t[0]) for (i, t) in
                   enumerate(specs)]
        db = testing.db
        t_table = Table('types', metadata, *columns)
        metadata.create_all()
        m2 = MetaData(db)
        rt = Table('types', m2, autoload=True)
        try:
            db.execute('CREATE VIEW types_v AS SELECT * from types')
            rv = Table('types_v', m2, autoload=True)
            expected = [len(c) > 1 and c[1] or c[0] for c in specs]
            for table in rt, rv:
                for i, reflected in enumerate(table.c):
                    assert isinstance(reflected.type,
                            type(expected[i])), '%d: %r' % (i,
                            type(expected[i]))
        finally:
            db.execute('DROP VIEW types_v')
Example #30
0
class Product(Base):
    __tablename__ = 'products'

    id = Column(Integer,
                nullable=False,
                unique=True,
                primary_key=True,
                autoincrement=True)
    name = Column(VARCHAR(255), nullable=False, unique=True)
    image_url = Column(VARCHAR(512), nullable=True)
    rating = Column(NUMERIC(4, 2), nullable=True)
    link_url = Column(VARCHAR(512), nullable=False)
    reviews = relationship("Review", backref='product', lazy="dynamic")

    def __repr__(self) -> str:
        return "<{0.__class__.__name__}(id={0.id!r})>".format(self)