Source code for luna_python_matcher.plugins.thin_event.db_models

"""
Module contains `thin event` model
"""
from sqlalchemy import Column, SmallInteger, BIGINT, String, TIMESTAMP, Binary, MetaData, Integer
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.ext.declarative import declarative_base


Base = declarative_base()
metadata = MetaData()


[docs]class ThinEvent(Base): """Thin event ORM class""" Base.metadata = metadata __tablename__ = "thin_event" # id from event table numeric_id = Column(BIGINT, nullable=False, index=True, primary_key=True) # event id event_id = Column(UUID(as_uuid=True), nullable=False, unique=True, index=True) # descriptor - event binary descriptor descriptor = Column(Binary(4096), nullable=True) # insert time insert_time = Column(TIMESTAMP, nullable=False, index=True) # create time create_time = Column(TIMESTAMP, nullable=False, index=True) # end time end_time = Column(TIMESTAMP, nullable=False, index=True) # external id external_id = Column(String(36), index=True) # source source = Column(String(128), index=True) # gender: 1 - male, 0 - female gender = Column(SmallInteger, index=True) # the integer part of age age = Column(SmallInteger, index=True) # the dominating emotion emotion = Column(SmallInteger, index=True) # the dominating mask mask = Column(SmallInteger, index=True) # the dominating ethnic_group ethnic_group = Column(SmallInteger, index=True) # user data - some string passed by user user_data = Column(String(128), index=True) # tag tag = Column(String(36), nullable=True, index=True) # descriptor version descriptor_version = Column(Integer, index=True)