Ejemplo n.º 1
0
class PatientDao(db.Model):
    __tablename__ = 'patients'
    __table_args__ = (ForeignKeyConstraint(['patient_type_symbol'],
                                           ['patient_type.symbol'],
                                           name="fk_patient_type_sybol"), )

    id = Column(Integer, Sequence('patient_id_seq'), primary_key=True)
    email = Column(String, unique=True, nullable=False)
    name = Column(String, nullable=False)
    surname = Column(String, nullable=False)
    birthdate = Column(Date, nullable=False)
    sex = Column(String, nullable=False)
    patient_type_symbol = Column(String, ForeignKey('patient_type.symbol'))

    def __init__(self, email: str, name: str, surname: str, birthdate: Date,
                 sex: SexType, patient_type: PatientTypeDao):
        self.email = email
        self.name = name
        self.surname = surname
        self.birthdate = birthdate
        self.sex = sex.name
        self.patient_type_symbol = patient_type.name

    def toParamsDict(self):
        return {
            'id': self.id,
            'first_name': self.name,
            'last_name': self.surname,
            'birthdate': self.birthdate,
            'email': self.email,
            'sex': self.sex,
            'type': self.patient_type_symbol
        }
Ejemplo n.º 2
0
class SqlStoredEvent(Base):
    # Explicit table name.
    __tablename__ = 'stored_events'

    # Unique constraint.
    __table_args__ = UniqueConstraint('aggregate_id',
                                      'aggregate_version',
                                      name='stored_events_uc'),

    # Primary key.
    id = Column(Integer, Sequence('stored_event_id_seq'), primary_key=True)

    # Sequence ID (e.g. an entity or aggregate ID).
    aggregate_id = Column(UUIDType(), index=True)

    # Position (timestamp) of item in sequence.
    aggregate_version = Column(BigInteger(), index=True)

    # Type of the event (class name).
    event_type = Column(String(100))

    # Timestamp of the event.
    timestamp = Column(Float())

    # State of the item (serialized dict, possibly encrypted).
    state = Column(Text())
Ejemplo n.º 3
0
class CommonLookups(Base):
    __tablename__ = "common_lookup_tbl"
    __table_args__ = {'schema': 'apps'}
    primary_id = Column('primary_id',
                        Integer,
                        Sequence('lookup_primary_id_sequence', schema='apps'),
                        primary_key=True)
    lookup_name = Column('lookup_name', String)
    lookup_code = Column('lookup_code', String)
    meaning = Column('meaning', String)
    description = Column('description', String)
    tag = Column('tag', String)
    enabled = Column('enabled', String)
    effective_from = Column('effective_from',
                            DateTime,
                            default=datetime.datetime.utcnow)
    effective_to = Column('effective_to', DateTime)
    created_by = Column('created_by', Integer)
    creation_date = Column('creation_date',
                           DateTime,
                           default=datetime.datetime.utcnow)
    last_update_date = Column('last_update_date',
                              DateTime,
                              default=datetime.datetime.utcnow,
                              onupdate=datetime.datetime.utcnow)
    last_updated_by = Column('last_updated_by', Integer)
class PurchaseTrxHeader(Base):
    __tablename__ = "purchase_trx_header_tbl"
    __table_args__ = {'schema': 'apps'}
    transaction_header_id = Column('transaction_header_id',
                                   Integer,
                                   Sequence('purchase_trx_header_sequence',
                                            schema='apps'),
                                   primary_key=True)
    purchase_trx_number = Column('purchase_trx_number', String)
    transaction_date = Column('transaction_date',
                              DateTime,
                              default=datetime.datetime.utcnow)
    order_status = Column('order_status', String)
    buyer_id = Column('buyer_id', Integer)
    supplier_id = Column('supplier_id', Integer)
    created_by = Column('created_by', Integer)
    creation_date = Column('creation_date',
                           DateTime,
                           default=datetime.datetime.utcnow)
    last_update_date = Column('last_update_date',
                              DateTime,
                              default=datetime.datetime.utcnow,
                              onupdate=datetime.datetime.utcnow)
    last_updated_by = Column('last_updated_by', Integer)

    purchase_trx_lines = relationship(
        'model.PurchaseTrxLines.PurchaseTrxLines',
        back_populates='purchase_trx_header')
class ReceiptHeader(Base):
    __tablename__ = "receipt_header_tbl"
    __table_args__ = {'schema': 'apps'}
    receipt_header_id = Column('receipt_header_id',
                               Integer,
                               Sequence('receipt_header_sequence',
                                        schema='apps'),
                               primary_key=True)
    receipt_number = Column('receipt_number', String)
    challan_number = Column('challan_number', String)
    receipt_date = Column('receipt_date', DateTime)
    challan_date = Column('challan_date', DateTime)
    source_transaction_header_id = Column('source_transaction_header_id',
                                          String)
    source_transaction_type = Column('source_transaction_type', String)
    vehicle_number = Column('vehicle_number', String)
    bata = Column('bata', Float)
    net_weight = Column('net_weight', Float)
    average_weight = Column('average_weight', Float)
    total_bags = Column('total_bags', Float)
    unit_of_measure = Column('unit_of_measure', String, default='KG')
    created_by = Column('created_by', Integer)
    creation_date = Column('creation_date',
                           DateTime,
                           default=datetime.datetime.utcnow)
    last_update_date = Column('last_update_date',
                              DateTime,
                              default=datetime.datetime.utcnow,
                              onupdate=datetime.datetime.utcnow)
    last_updated_by = Column('last_updated_by', Integer)
    receipt_header_status = Column('receipt_header_status', String)

    receipt_lines = relationship('model.ReceiptLines.ReceiptLines',
                                 back_populates='receipt_header')
Ejemplo n.º 6
0
class ReceiptLines(Base):
    __tablename__ = "receipt_lines_tbl"
    __table_args__ = {'schema': 'apps'}
    receipt_line_id = Column('receipt_line_id',
                             Integer,
                             Sequence('receipt_lines_sequence', schema='apps'),
                             primary_key=True)
    receipt_header_id = Column(
        'receipt_header_id', Integer,
        ForeignKey('apps.receipt_header_tbl.receipt_header_id'))
    line_number = Column('line_number', Integer, nullable=False)
    item_id = Column('item_id', Integer)
    description = Column('description', String)
    load_unload_number = Column('load_unload_number', String)
    load_unload_area = Column('load_unload_area', String)
    weighing_number = Column('weighing_number', String)
    receipt_line_status = Column('receipt_line_status', String)
    quantity = Column('quantity', Float)
    number_of_bags = Column('number_of_bags', Float)
    unit_price = Column('unit_price', Float)
    unit_of_measure = Column('unit_of_measure', String, default='KG')
    discount = Column('discount', Float)
    created_by = Column('created_by', Integer)
    creation_date = Column('creation_date',
                           DateTime,
                           default=datetime.datetime.utcnow)
    last_update_date = Column('last_update_date',
                              DateTime,
                              default=datetime.datetime.utcnow,
                              onupdate=datetime.datetime.utcnow)
    last_updated_by = Column('last_updated_by', Integer)

    receipt_header = relationship("model.ReceiptHeader.ReceiptHeader",
                                  back_populates="receipt_lines")
class User(Base):
    __tablename__ = "user_tbl"
    __table_args__ = {'schema': 'apps'}
    user_id = Column('user_id',
                     Integer,
                     Sequence('user_id_sequence', schema='apps'),
                     primary_key=True)
    user_name = Column('user_name', String)
    description = Column('description', String)
    phone_number1 = Column('phone_number1', String)
    phone_number2 = Column('phone_number2', String)
    email = Column('email', String)
    password = Column('password', String)
    user_type = Column('user_type', String)
    effective_from = Column('effective_from', DateTime)
    effective_to = Column('effective_to', DateTime)
    created_by = Column('created_by', Integer)
    creation_date = Column('creation_date',
                           DateTime,
                           default=datetime.datetime.utcnow)
    last_update_date = Column('last_update_date',
                              DateTime,
                              default=datetime.datetime.utcnow,
                              onupdate=datetime.datetime.utcnow)
    last_updated_by = Column('last_updated_by', Integer)
    password_life_span = Column('password_life_span', Integer)
    employee_id = Column('employee_id', Integer)
Ejemplo n.º 8
0
class SalesTrxLines(Base):
    __tablename__ = "sales_trx_lines_tbl"
    __table_args__ = {'schema': 'apps'}
    transaction_line_id = Column('transaction_line_id',
                                 Integer,
                                 Sequence('sales_trx_lines_sequence',
                                          schema='apps'),
                                 primary_key=True)
    transaction_header_id = Column(
        'transaction_header_id', Integer,
        ForeignKey('apps.sales_trx_header_tbl.transaction_header_id'))
    item_id = Column('item_id', Integer)
    booking_unit_price = Column('booking_unit_price', Float)
    booking_quantity = Column('booking_quantity', Float)
    unit_of_measure = Column('unit_of_measure', String)
    created_by = Column('created_by', Integer)
    creation_date = Column('creation_date',
                           DateTime,
                           default=datetime.datetime.utcnow)
    last_update_date = Column('last_update_date',
                              DateTime,
                              default=datetime.datetime.utcnow,
                              onupdate=datetime.datetime.utcnow)
    last_updated_by = Column('last_updated_by', Integer)
    line_number = Column('line_number', Integer, nullable=False)

    sales_trx_header = relationship("model.SalesTrxHeader.SalesTrxHeader",
                                    back_populates="sales_trx_lines")
Ejemplo n.º 9
0
class SqlTimestampSequencedItem(Base):

    # Explicit table name.
    __tablename__ = 'timestamp_sequenced_items'

    # Unique constraint.
    __table_args__ = UniqueConstraint('sequence_id',
                                      'position',
                                      name='time_sequenced_items_uc'),

    # Primary key.
    id = Column(Integer,
                Sequence('integer_sequened_item_id_seq'),
                primary_key=True)

    # Sequence ID (e.g. an entity or aggregate ID).
    sequence_id = Column(UUIDType(), index=True)

    # Position (timestamp) of item in sequence.
    position = Column(Float(), index=True)

    # Topic of the item (e.g. path to domain event class).
    topic = Column(String(255))

    # State of the item (serialized dict, possibly encrypted).
    data = Column(Text())
Ejemplo n.º 10
0
class SqlIntegerSequencedItem(Base):
    __tablename__ = 'integer_sequenced_items'

    id = Column(Integer,
                Sequence('integer_sequened_item_id_seq'),
                primary_key=True)

    # Sequence ID (e.g. an entity or aggregate ID).
    sequence_id = Column(UUIDType(), index=True)

    # Position (index) of item in sequence.
    position = Column(BigInteger(), index=True)

    # Topic of the item (e.g. path to domain event class).
    topic = Column(String(255))

    # State of the item (serialized dict, possibly encrypted).
    data = Column(Text())

    # Unique constraint includes 'entity_id' which is a good value
    # to partition on, because all events for an entity will be in the same
    # partition, which may help performance.
    __table_args__ = UniqueConstraint('sequence_id',
                                      'position',
                                      name='integer_sequenced_item_uc'),
Ejemplo n.º 11
0
class Catalogue(Base):
    __tablename__="catalogues"
    id = Column(Integer,Sequence("catalogue_id_seq"),primary_key=True)
    title = Column(String(1000))
    article=relationship("Article", backref="catalogues")
    def __init__(self,title):
        self.title=title
    def __repr(self):
        return "<Catalogue('%s')>"%(self.title)
Ejemplo n.º 12
0
class SqlStoredEvent(Base):

    __tablename__ = 'stored_events'

    id = Column(Integer, Sequence('stored_event_id_seq'), primary_key=True)
    event_id = Column(String(255), index=True)
    timestamp_long = Column(BigInteger(), index=True)
    stored_entity_id = Column(String(255), index=True)
    event_topic = Column(String(255))
    event_attrs = Column(Text())
Ejemplo n.º 13
0
class ReportCardSubject(Base):
    __tablename__ = 'report_card_subject'
    report_card_subject_id = Column(Integer,
                                    Sequence('report_card_subject_id'),
                                    primary_key=True)
    report_card_id = Column(
        Integer, ForeignKey('report_card.report_card_id', ondelete="CASCADE"))
    subject_name = Column(String(255))
    marks = Column(Float)
    max_marks = Column(Float)
Ejemplo n.º 14
0
class Article(Base):
    __tablename__ = "articles"
    id = Column(Integer, Sequence("article_id_seq"), primary_key=True)
    title = Column(String(1000))
    catalogue_id=Column(Integer,ForeignKey("catalogues.id"))
    catalogue=relationship("Catalogue",backref=backref('catalogues',order_by=id))
    replys=relationship("Reply", backref="articles")
    def __init__(self,title,catalogue_id):
        self.title=title
        self.catalogue_id=catalogue_id
    def __repr(self):
        return "<Article('%s')>"%(self.title)
class CustomerMasterSites (Base):
    __tablename__ = "customer_master_sites_tbl"
    __table_args__ = {'schema' : 'apps'}
    customer_site_id = Column('customer_site_id', Integer, Sequence('customer_site_id_sequence', schema='apps') , primary_key = True)
    customer_id = Column('customer_id', Integer,ForeignKey('apps.customer_master_header_tbl.customer_id'))
    customer_site_code = Column('customer_site_code', String)
    customer_address = Column('customer_address', String)
    phone_number1 = Column('phone_number1', String)
    phone_number2 = Column('phone_number2', String)
    email = Column('email', String)
    effective_from = Column('effective_from', DateTime)
    effective_to = Column('effective_to', DateTime)
    created_by = Column('created_by', Integer)
    creation_date = Column('creation_date', DateTime,default=datetime.datetime.utcnow)
    last_update_date = Column('last_update_date',DateTime, default=datetime.datetime.utcnow, onupdate=datetime.datetime.utcnow)
    last_updated_by = Column('last_updated_by', Integer)
    
    customer = relationship("model.CustomerMasterHeader.CustomerMasterHeader", back_populates="sites")
Ejemplo n.º 16
0
class LiveDbItem(Tuple, DeclarativeBase):
    __tupleTypeShort__ = 'LDK'
    __tablename__ = 'LiveDbItem'
    __tupleType__ = livedbTuplePrefix + __tablename__

    NUMBER_VALUE = 0
    STRING_VALUE = 1
    COLOR = 2
    LINE_WIDTH = 3
    LINE_STYLE = 4
    GROUP_PTR = 5

    id_seq = Sequence('LiveDbItem_id_seq',
                      metadata=DeclarativeBase.metadata,
                      schema=DeclarativeBase.metadata.schema)
    id = Column(Integer, id_seq, server_default=id_seq.next_value(),
                primary_key=True, autoincrement=False)

    modelSetId = Column(Integer, ForeignKey('LiveDbModelSet.id', ondelete='CASCADE'),
                        doc=JSON_EXCLUDE, nullable=False)
    modelSet = relationship(LiveDbModelSet)

    # comment="The unique reference of the value we want from the live db"
    key = Column(String, nullable=False)

    # comment="The last value from the source"
    rawValue = Column(String)

    # comment="The PEEK value, converted to PEEK IDs if required (Color for example)"
    displayValue = Column(String)

    # comment="The type of data this value represents"
    dataType = Column(Integer, nullable=False)

    importHash = Column(String)

    # Store custom props for this link
    propsJson = Column(String)

    __table_args__ = (
        Index("idx_LiveDbDKey_importHash", importHash, unique=False),
        Index("idx_LiveDbDKey_modelSet_key", modelSetId, key, unique=True),
    )
class AccessRights(Base):
    __tablename__ = "access_rights_tbl"
    __table_args__ = {'schema': 'apps'}
    access_id = Column('access_id',
                       Integer,
                       Sequence('access_id_sequence', schema='apps'),
                       primary_key=True)
    user_type = Column('user_type', String)
    access_area = Column('access_area', String)
    view = Column('view', String)
    create = Column('create', String)
    update = Column('update', String)
    delete = Column('delete', String)
    effective_from = Column('effective_from', DateTime)
    effective_to = Column('effective_to', DateTime)
    created_by = Column('created_by', Integer)
    creation_date = Column('creation_date', DateTime)
    last_update_date = Column('last_update_date', Integer)
    last_updated_by = Column('last_updated_by', Integer)
Ejemplo n.º 18
0
class Jobstate(Base):
    __tablename__="jobsstate"
    id = Column(Integer,Sequence("jobsstate_id_seq"),primary_key=True)
    
    scriptname=Column(String(1000))
    foldername=Column(String(1000))
    scriptcontent=Column(String(1000))
    outputinfo=Column(Text())
# startdate=Column(DateTime, default=time.strftime(ISOTIMEFORMAT, time.localtime()))
    startdate=Column(DateTime)
    finishdate=Column(DateTime)
    state=Column(Integer)
    def __init__(self,scriptname,foldername,state):
        self.scriptname=scriptname
        self.foldername=foldername
        self.state=state

    def __repr(self):
        return "<Jobstat('%s')>"%(self.scriptname)
Ejemplo n.º 19
0
class CustomerMasterHeader (Base):
    __tablename__ = "customer_master_header_tbl"
    __table_args__ = {'schema' : 'apps'}
    customer_id = Column('customer_id', Integer, Sequence('customer_id_sequence', schema='apps') , primary_key = True)
    customer_code = Column('customer_code', String)
    customer_name = Column('customer_name', String)
    description = Column('description', String)
    customer_type = Column('customer_type', String)
    remarks = Column('remarks', String)
    enabled_flag = Column('enabled_flag', String)
    effective_from = Column('effective_from', DateTime)
    effective_to = Column('effective_to', DateTime)
    created_by = Column('created_by', Integer)  
    creation_date = Column('creation_date', DateTime,default=datetime.datetime.utcnow)
    last_update_date = Column('last_update_date',DateTime, default=datetime.datetime.utcnow, onupdate=datetime.datetime.utcnow)
    last_updated_by = Column('last_updated_by', Integer)
    
    sites = relationship('model.CustomerMasterSites.CustomerMasterSites', back_populates='customer')
    
    
Ejemplo n.º 20
0
class Person (Base):
    __tablename__ = "person_tbl"
    __table_args__ = {'schema' : 'apps'}
    person_id = Column('person_id', Integer, Sequence('person_id_sequence', schema='apps') , primary_key = True)
    employee_number = Column('employee_number', String)
    first_name = Column('first_name', String)
    middle_name = Column('middle_name', String)
    last_name = Column('last_name', String)
    date_of_birth = Column('date_of_birth', Date)
    gender = Column('gender', String)
    address = Column('address', String)
    phone_number1 = Column('phone_number1', String)
    phone_number2 = Column('phone_number2', String)
    email = Column('email', String)
    effective_from = Column('effective_from', DateTime)
    effective_to = Column('effective_to', DateTime)
    created_by = Column('created_by', Integer)
    creation_date = Column('creation_date', DateTime)
    last_updated_by = Column('last_updated_by', Integer)
    last_update_date = Column('last_update_date', DateTime)
    
Ejemplo n.º 21
0
class Jobs_recoder(Base):
    __tablename__="jobs_recoder"
    id = Column(Integer,Sequence("jobs_recoder_id_seq"),primary_key=True)
    logicalpurpose=Column(String(200))
    scriptname=Column(String(1000))
    foldername=Column(String(1000))
    inputdata=Column(String(1000))
    outputdata=Column(String(1000))
    scriptcontent=Column(String(1000))
    outputinfo=Column(Text())
# startdate=Column(DateTime, default=time.strftime(ISOTIMEFORMAT, time.localtime()))
    startdate=Column(DateTime)
    finishdate=Column(DateTime)
    state=Column(Integer)
    def __init__(self,scriptname,foldername,logicalpurpose,state):
        if foldername[-1]=="/":
            foldername=foldername[0:-1]
        scriptfile=open(foldername+"/"+scriptname,'r')
        line=scriptfile.readline()
        if re.search(r"^scriptinputdata=(.*)",line)!=None:
            self.inputdata=re.search(r"^scriptinputdata=(.*)",line).group(1)
        else:
            self.inputdata="unknow"
        line=scriptfile.readline()
        if re.search(r"^scriptoutputdata=(.*)",line)!=None:
            self.outputdata=re.search(r"^scriptoutputdata=(.*)",line).group(1)
        else:
            self.outputdata="unknow"
#         scriptcontent_all=scriptfile.read()
#         scriptfile.close()
#         if re.search(r"(.*(\n)*)cmdline=\s*(.*)",scriptcontent_all)!=None:
#             scriptcontent_cmdline=re.search(r"(.*(\n)*)cmdline=\s*(.*)",scriptcontent_all).group(3)
#             self.scriptcontent=scriptcontent_cmdline
        self.scriptname=scriptname
        self.foldername=foldername
        self.state=state
        self.logicalpurpose=logicalpurpose

    def __repr(self):
        return "<jobs_recoder('%s')>"%(self.scriptname)
Ejemplo n.º 22
0
class ReportCard(Base):

    INDEX_EXAM_NAME = 0
    INDEX_NAME = 1
    INDEX_ADM_NO = 2
    INDEX_CLASS = 3
    INDEX_SECTION = 4

    __tablename__ = 'report_card'
    report_card_id = Column(Integer,
                            Sequence('report_card_id'),
                            primary_key=True)
    exam_name = Column(String(255))
    student_name = Column(String(255))
    student_addmission_number = Column(String(255))
    student_class = Column(String(50))
    student_section = Column(String(10))
    report_card_subjects = relationship('ReportCardSubject',
                                        backref='report_card',
                                        lazy=True,
                                        passive_deletes=True,
                                        cascade='all, delete, delete-orphan')
    def setup(self):
        self.graph = create_object_graph(
            "microcosm_eventsource",
            root_path=join(dirname(__file__), pardir),
            testing=True,
        )
        self.graph.use(
            "task_store",
            "task_event_store",
            "activity_store",
            "activity_event_store",
        )
        self.store = self.graph.task_event_store

        self.context = SessionContext(self.graph)
        self.context.recreate_all()
        self.context.open()

        with transaction() as session:
            self.task = Task().create()

            self.offset = session.execute(Sequence("task_event_clock_seq"))
class InventoryItems(Base):
    __tablename__ = "inventory_item_tbl"
    __table_args__ = {'schema': 'apps'}
    item_id = Column('item_id',
                     Integer,
                     Sequence('item_id_sequence', schema='apps'),
                     primary_key=True)
    item_number = Column('item_number', String)
    organization_id = Column('organization_id', Integer)
    enabled_flag = Column('enabled_flag', String)
    description = Column('description', String)
    buyer_id = Column('buyer_id', Integer)
    item_type = Column('item_type', String)
    long_description = Column('long_description', String)
    asset_flag = Column('asset_flag', String)
    asset_id = Column('asset_id', Integer)
    purchasing_enabled_flag = Column('purchasing_enabled_flag', String)
    customer_order_enabled_flag = Column('customer_order_enabled_flag', String)
    returnable_flag = Column('returnable_flag', String)
    inspection_required_flag = Column('inspection_required_flag', String)
    list_price_per_unit = Column('list_price_per_unit', String)
    shelf_life_days = Column('shelf_life_days', String)
    item_control_code = Column('item_control_code', String)
    min_order_quantity = Column('min_order_quantity', String)
    max_order_quantity = Column('max_order_quantity', String)
    planner_code = Column('planner_code', String)
    transaction_uom = Column('transaction_uom', String)
    conversion = Column('conversion', Float)
    base_uom = Column('base_uom', String)
    created_by = Column('created_by', Integer)
    creation_date = Column('creation_date',
                           DateTime,
                           default=datetime.datetime.utcnow)
    last_update_date = Column('last_update_date',
                              DateTime,
                              default=datetime.datetime.utcnow,
                              onupdate=datetime.datetime.utcnow)
    last_updated_by = Column('last_updated_by', Integer)
    def setup(self):
        loader = load_from_dict(
            secret=dict(postgres=dict(
                host=environ.get("MICROCOSM_EVENTSOURCE__POSTGRES__HOST",
                                 "localhost"),
                password=environ.get(
                    "MICROCOSM_EVENTSOURCE__POSTGRES__PASSWORD", ""),
            ), ),
            postgres=dict(
                host=environ.get("MICROCOSM_EVENTSOURCE__POSTGRES__HOST",
                                 "localhost"),
                password=environ.get(
                    "MICROCOSM_EVENTSOURCE__POSTGRES__PASSWORD", ""),
            ),
            sns_producer=dict(mock_sns=False, ),
        )
        self.graph = create_object_graph(
            "microcosm_eventsource",
            loader=loader,
            root_path=dirname(__file__),
            testing=True,
        )
        self.graph.use(
            "session_factory",
            "task_store",
            "task_event_store",
            "task_event_controller",
            "task_crud_routes",
        )
        self.client = self.graph.flask.test_client()
        recreate_all(self.graph)

        with SessionContext(self.graph), transaction() as session:
            self.task = Task().create()
            self.graph.sns_producer.sns_client.reset_mock()

            self.offset = session.execute(Sequence("task_event_clock_seq"))
class SupplierMasterSites(Base):
    __tablename__ = "supplier_master_sites_tbl"
    __table_args__ = {'schema': 'apps'}
    supplier_site_id = Column('supplier_site_id',
                              Integer,
                              Sequence('supplier_site_id_sequence',
                                       schema='apps'),
                              primary_key=True)
    supplier_id = Column(
        'supplier_id', Integer,
        ForeignKey('apps.supplier_master_header_tbl.supplier_id'))
    supplier_site_code = Column('supplier_site_code', String)
    supplier_site_address = Column('supplier_site_address', String)
    phone_number1 = Column('phone_number1', String)
    phone_number2 = Column('phone_number2', String)
    email = Column('email', String)
    payment_method_lookup_code = Column('payment_method_lookup_code', String)
    gstin_number = Column('gstin_number', String)
    pay_group_lookup_code = Column('pay_group_lookup_code', String)
    payment_term = Column('payment_term', String)
    purchasing_site_flag = Column('purchasing_site_flag', String)
    rfq_only_site = Column('rfq_only_site', String)
    tax_registration_number = Column('tax_registration_number', String)
    inactive_date = Column('inactive_date', Date)
    created_by = Column('created_by', Integer)
    creation_date = Column('creation_date',
                           DateTime,
                           default=datetime.datetime.utcnow)
    last_update_date = Column('last_update_date',
                              DateTime,
                              default=datetime.datetime.utcnow,
                              onupdate=datetime.datetime.utcnow)
    last_updated_by = Column('last_updated_by', Integer)

    supplier = relationship("model.SupplierMasterHeader.SupplierMasterHeader",
                            back_populates="sites")