class SlaveMasterInfo(SAFRSBase, Base): __tablename__ = "slave_master_info" Number_of_lines = Column(INTEGER(10), nullable=False) Master_log_name = Column(TEXT, nullable=False) Master_log_pos = Column(BIGINT(20), nullable=False) Host = Column(CHAR(64)) User_name = Column(TEXT) User_password = Column(TEXT) Port = Column(INTEGER(10), nullable=False) Connect_retry = Column(INTEGER(10), nullable=False) Enabled_ssl = Column(TINYINT(1), nullable=False) Ssl_ca = Column(TEXT) Ssl_capath = Column(TEXT) Ssl_cert = Column(TEXT) Ssl_cipher = Column(TEXT) Ssl_key = Column(TEXT) Ssl_verify_server_cert = Column(TINYINT(1), nullable=False) Heartbeat = Column(Float, nullable=False) Bind = Column(TEXT) Ignored_server_ids = Column(TEXT) Uuid = Column(TEXT) Retry_count = Column(BIGINT(20), nullable=False) Ssl_crl = Column(TEXT) Ssl_crlpath = Column(TEXT) Enabled_auto_position = Column(TINYINT(1), nullable=False) Channel_name = Column(CHAR(64), primary_key=True) Tls_version = Column(TEXT)
class Dossier(Base): __tablename__ = 'dossier' id_dossier = Column(INTEGER(10), primary_key=True) dossier = Column(String(15), nullable=False, unique=True, server_default=text("''")) id_voyage = Column(String(15)) id_client = Column(String(15)) desti = Column(LargeBinary) expe = Column(LargeBinary) assur = Column(CHAR(1)) cond_trans = Column(TINYINT(3)) fact_march = Column(String(255)) mt_march = Column(DECIMAL(10, 2)) cond_regl = Column(TINYINT(3)) tot_colis = Column(DECIMAL(10, 2)) tot_poids = Column(DECIMAL(10, 2)) tot_volume = Column(DECIMAL(10, 3)) col_nb = Column(String(100)) col_type = Column(String(100)) col_nature = Column(LargeBinary) col_poids = Column(String(100)) col_volume = Column(String(100)) rem = Column(LargeBinary) type = Column(CHAR(1)) stat_dos = Column(CHAR(1))
class ContentFill(Base): __tablename__ = 'tbl_content_fill' id_content_fill = Column(INTEGER(11), primary_key=True) id_content = Column(INTEGER(11), nullable=False) textOrfile = Column(Text(collation='utf8mb4_unicode_ci'), nullable=False) active = Column(TINYINT(1), nullable=False) position = Column(INTEGER(11), nullable=False) type = Column(TINYINT(4), nullable=False)
class BaseModel(db.Model, MixinJSONSerializer): __abstract__ = True uid = Column(UUID, primary_key=True, nullable=False) utc_created = Column(DATETIME, nullable=False) utc_modified = Column(DATETIME, nullable=False) status = Column(TINYINT(unsigned=True), default=1, nullable=False) def __init__(self): self.uid = uuid.uuid1() now = datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S") self.utc_created = now self.utc_modified = now @classmethod def save(cls, **kwargs): one = cls() for key in kwargs.keys(): if hasattr(one, key): setattr(one, key, kwargs[key]) db.session.add(one) return one def update(self, **kwargs): for key in kwargs.keys(): if hasattr(self, key): setattr(self, key, kwargs[key]) self.utc_modified = datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S") db.session.add(self) def remove(self): self.update(status=0) def activate(self): self.update(status=1)
class Client(Base): __tablename__ = 'client' id_client = Column(INTEGER(10), primary_key=True) client = Column(String(20), nullable=False, index=True, server_default=text("''")) siret = Column(String(30)) raison_soc = Column(String(255)) adresse = Column(String(255)) cp = Column(String(15)) ville = Column(String(100)) tel = Column(String(25)) fax = Column(String(25)) email = Column(String(100)) contact_titre = Column(String(100)) contact_nom = Column(LargeBinary) contact_fonction = Column(LargeBinary) contact_tel = Column(LargeBinary) contact_port = Column(LargeBinary) contact_fax = Column(LargeBinary) contact_email = Column(LargeBinary) police_flot = Column(CHAR(1)) cond_regl = Column(TINYINT(3)) obs = Column(LargeBinary) stat_cli = Column(CHAR(1))
class Func(SAFRSBase, Base): __tablename__ = 'func' name = Column(CHAR(64, 'utf8_bin'), primary_key=True, server_default=text("''")) ret = Column(TINYINT(1), nullable=False, server_default=text("'0'")) dl = Column(CHAR(128, 'utf8_bin'), nullable=False, server_default=text("''")) type = Column(ENUM('function', 'aggregate'), nullable=False)
class Forum(Base, BaseModel): __tablename__ = 'forum' id = Column(Integer, primary_key=True) name = Column(String(255)) spider_name = Column(String(255)) domain = Column(String(255)) logo = Column(String(255)) thread_count = Column(TINYINT(4), server_default=text("'1'")) is_del = Column(Integer) create_ts = Column(Integer) update_ts = Column(Integer) def __init__(self, *arg, **kw): self.id = kw.get("id", None) self.name = kw.get("name", None) self.spider_name = kw.get("spider_name", None) self.domain = kw.get("domain", None) self.logo = kw.get("logo", None) self.thread_count = kw.get("thread_count", None) self.is_del = kw.get("is_del", None) self.create_ts = kw.get("create_ts", None) self.update_ts = kw.get("update_ts", None) @staticmethod def getSpiderNameByForumId(_id, session): return session.query(Forum.spider_name).filter(Forum.id == _id).all()
class ProxiesPriv(SAFRSBase, Base): __tablename__ = "proxies_priv" Host = Column(CHAR(60, "utf8_bin"), primary_key=True, nullable=False, server_default=text("''")) User = Column(CHAR(32, "utf8_bin"), primary_key=True, nullable=False, server_default=text("''")) Proxied_host = Column(CHAR(60, "utf8_bin"), primary_key=True, nullable=False, server_default=text("''")) Proxied_user = Column(CHAR(32, "utf8_bin"), primary_key=True, nullable=False, server_default=text("''")) With_grant = Column(TINYINT(1), nullable=False, server_default=text("'0'")) Grantor = Column(CHAR(93, "utf8_bin"), nullable=False, index=True, server_default=text("''")) Timestamp = Column( TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
class QcmNewModel(Base, BaseModel): __tablename__ = 'qcm_new' id = Column(Integer, primary_key=True) name = Column(String(120), unique=True) crawl_ts = Column(Integer) url = Column(String(120)) is_del = Column(TINYINT(1)) create_ts = Column(Integer) update_ts = Column(Integer) def __init__(self, *arg, **kw): self.crawl_ts = kw.get("crawl_ts", None) self.create_ts = kw.get("create_ts", None) self.id = kw.get("id", None) self.is_del = kw.get("is_del", None) self.metadata = kw.get("metadata", None) self.name = kw.get("name", None) self.update_ts = kw.get("update_ts", None) self.url = kw.get("url", None) @staticmethod def addQcm(data, session): name = data.get("name") if name: exists = QcmNewModel.getByName(name, session) else: return 0 if not exists: qcm = QcmNewModel(**data) QcmNewModel.addModel(qcm, session) return qcm.id return exists[0].id
class Url(Base, BaseModel): __tablename__ = 'url' id = Column(Integer, primary_key=True) domain = Column(String(100)) url = Column(String(255)) name = Column(String(255)) level = Column(Integer) p_id = Column(Integer) query_types = Column(String(255)) is_del = Column(TINYINT(1)) create_ts = Column(Integer) update_ts = Column(Integer) def __init__(self, *arg, **kw): self.create_ts = kw.get("create_ts", None) self.domain = kw.get("domain", None) self.id = kw.get("id", None) self.is_del = kw.get("is_del", None) self.level = kw.get("level", None) self.metadata = kw.get("metadata", None) self.name = kw.get("name", None) self.p_id = kw.get("p_id", None) self.query_types = kw.get("query_types", None) self.update_ts = kw.get("update_ts", None) self.url = kw.get("url", None) @staticmethod def geIdByDomainAndPid(domain, pid, sessoin): return sessoin.query(Url.id).filter(Url.domain == domain, Url.p_id == pid).order_by("id").all()
class Voyage(Base): __tablename__ = 'voyage' id_voyage = Column(INTEGER(10), primary_key=True) voyage = Column(String(30), nullable=False, unique=True, server_default=text("''")) d_dep = Column(DateTime) bateau = Column(String(100)) mode_trans = Column(String(50)) port_emb = Column(TINYINT(3)) port_deb = Column(TINYINT(3)) deb_lib = Column(String(100)) deb_mt = Column(LargeBinary) deb_total = Column(DECIMAL(10, 2))
class TimeZoneTransitionType(SAFRSBase, Base): __tablename__ = "time_zone_transition_type" Time_zone_id = Column(INTEGER(10), primary_key=True, nullable=False) Transition_type_id = Column(INTEGER(10), primary_key=True, nullable=False) Offset = Column(INTEGER(11), nullable=False, server_default=text("'0'")) Is_DST = Column(TINYINT(3), nullable=False, server_default=text("'0'")) Abbreviation = Column(CHAR(8), nullable=False, server_default=text("''"))
class Section(Base): __tablename__ = 'tbl_section' id_section = Column(INTEGER(11), primary_key=True) name = Column(String(100, 'utf8mb4_unicode_ci'), nullable=False) photo = Column(String(191, 'utf8mb4_unicode_ci'), nullable=False) position = Column(INTEGER(11), nullable=False) active = Column(TINYINT(1), nullable=False)
class Rawtweet(Base): __tablename__ = 'rawtweets' rawid = Column(BigInteger, primary_key=True) tweetid = Column(BigInteger) tweetloc = Column(String(150)) tweettext = Column(Text) tweettime = Column(DateTime) hasgeo = Column(TINYINT(1))
class Content(Base): __tablename__ = 'tbl_content' __table_args__ = (Index('id_option', 'id_option', 'name', unique=True), ) id_content = Column(INTEGER(11), primary_key=True) id_option = Column(INTEGER(11), nullable=False) name = Column(String(100, 'utf8mb4_unicode_ci'), nullable=False) position = Column(INTEGER(11), nullable=False) active = Column(TINYINT(1), nullable=False)
class Model(db.Base): __tablename__ = 'tbl_app_grant_tickets' ticket_id = Column(INTEGER(11), primary_key=True, autoincrement=True) ticket_value = Column(CHAR(32)) ticket_created = Column(INTEGER(11)) ticket_expires = Column(INTEGER(11)) ticket_used = Column(TINYINT(1)) # boolean tbl_users_id = Column(INTEGER(11), ForeignKey('tbl_users.user_id')) tbl_apps_id = Column(INTEGER(11), ForeignKey('tbl_apps.app_id'))
class Message(Base): __tablename__ = 'message' stock_name = Column(String(40), primary_key=True) stock_id = Column(CHAR(30)) stock_price = Column(DECIMAL(7, 2)) continue_trans = Column(TINYINT(1), server_default=text("'1'")) up_confine = Column(DECIMAL(4, 2), server_default=text("'0.10'")) down_confine = Column(DECIMAL(4, 2), server_default=text("'0.10'"))
class IpSegment(Base, BaseModel): __tablename__ = 'ip_segment' id = Column(Integer, primary_key=True) ip_start = Column(String(255)) ip_stop = Column(String(255)) is_del = Column(TINYINT(1)) create_ts = Column(Integer) update_ts = Column(Integer)
class Dream(Base): __tablename__ = 'dreams' id = Column(String(40), primary_key=True) user_id = Column(String(40), nullable=False) title = Column(String(400), nullable=False) word = Column(Text, nullable=False) status = Column(TINYINT(4), nullable=False) remark = Column(String(400)) created = Column(DateTime, nullable=False)
class Model(db.Base): __tablename__ = 'tbl_apps' app_id = Column(INTEGER(11), primary_key=True, autoincrement=True) app_name = Column(VARCHAR(50)) client_url = Column(VARCHAR(255)) client_api = Column(VARCHAR(255)) client_domain = Column(VARCHAR(255)) client_secret = Column(CHAR(32)) client_ticket_expires = Column(INTEGER(11)) client_enable = Column(TINYINT(1)) # boolean
class LogCrawledModel(Base, BaseModel): __tablename__ = 'log_crawled' id = Column(Integer, primary_key=True) web_key = Column(String(40)) spiders = Column(String(40)) relation = Column(TINYINT(1)) is_del = Column(TINYINT(1)) c_ts = Column(Integer) u_ts = Column(Integer) def __init__(self, *arg, **kw): self.c_ts = kw.get("c_ts", None) self.web_key = kw.get("web_key", None) self.id = kw.get("id", None) self.is_del = kw.get("is_del", None) self.metadata = kw.get("metadata", None) self.relation = kw.get("relation", None) self.spiders = kw.get("spiders", None) self.u_ts = kw.get("u_ts", None)
class Func(SAFRSBase, Base): __tablename__ = "func" name = Column(CHAR(64, "utf8_bin"), primary_key=True, server_default=text("''")) ret = Column(TINYINT(1), nullable=False, server_default=text("'0'")) dl = Column(CHAR(128, "utf8_bin"), nullable=False, server_default=text("''")) type = Column(ENUM("function", "aggregate"), nullable=False)
class Processedtweet(Base): __tablename__ = 'processedtweets' proctwid = Column(Integer, primary_key=True) rawid = Column(BigInteger) tweetid = Column(BigInteger) tweetloc = Column(String(150)) tweettext = Column(Text) tweettime = Column(DateTime) hasgeo = Column(TINYINT(1)) beerid = Column(Integer) cityid = Column(Integer)
class Users(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) name = Column(CHAR(32),server_default='f',nullable=False,index=True,comment='姓名') extra = Column(String(16)) a = Column(TINYINT(1),server_default='0',nullable=False,comment='注释') # b = Column(String) __table_args__ = { 'mysql_charset':'utf8', 'mysql_engine':'innodb', "comment":'注释' }
class Etape(Base): __tablename__ = 'etape' id_Etape = Column(BIGINT(20), primary_key=True) nom = Column(String(30)) objectif = Column(String(255)) importance = Column(INTEGER(11)) valide_Etape = Column(TINYINT(1)) version_Etape = Column(String(30)) id_Langage = Column(ForeignKey('langage.id_Langage'), index=True) id_Workflow = Column(ForeignKey('workflow.id_Workflow'), index=True) langage = relationship('Langage') workflow = relationship('Workflow')
class Org(Base, BaseModel): __tablename__ = 'org' id = Column(Integer, primary_key=True) name = Column(String(255)) is_del = Column(TINYINT(1)) update_ts = Column(Integer) create_ts = Column(Integer) def __init__(self, *arg, **kw): self.create_ts = kw.get("create_ts", None) self.id = kw.get("id", None) self.is_del = kw.get("is_del", None) self.metadata = kw.get("metadata", None) self.name = kw.get("name", None) self.update_ts = kw.get("update_ts", None)