Example #1
0
from sqlalchemy.dialects.mysql import INTEGER, TINYINT
from sqlalchemy.ext.declarative import declarative_base
import XX.Model.SqlAlchemy.BaseModel as BaseModel

Base = declarative_base()
metadata = Base.metadata


class HotwordModel(Base, BaseModel.BaseModel):
    __tablename__ = 'hotword'

    id = Column(INTEGER(11), primary_key=True)
    word = Column(String(180))
    day = Column(Date)
    is_del = Column(TINYINT(1))
    update_ts = Column(INTEGER(11))
    create_ts = Column(INTEGER(11))

    def __init__(self, *arg, **kw):
        self.create_ts = kw.get("create_ts", None)
        self.day = kw.get("day", None)
        self.id = kw.get("id", None)
        self.is_del = kw.get("is_del", None)
        self.metadata = kw.get("metadata", None)
        self.update_ts = kw.get("update_ts", None)
        self.word = kw.get("word", None)


if __name__ == '__main__':
    BaseModel.createInitFunction(HotwordModel)
Example #2
0
    no3 = Column(INTEGER(11))
    no4 = Column(INTEGER(11))
    no5 = Column(INTEGER(11))
    is_del = Column(TINYINT(1))
    update_Ts = Column(INTEGER(11))
    create_ts = Column(INTEGER(11))

    def __init__(self, *arg, **kw):
        self.biz = kw.get("biz", None)
        self.create_ts = kw.get("create_ts", None)
        self.gh_id = kw.get("gh_id", None)
        self.head_img = kw.get("head_img", None)
        self.head_img_circle = kw.get("head_img_circle", None)
        self.id = kw.get("id", None)
        self.intro = kw.get("intro", None)
        self.is_del = kw.get("is_del", None)
        self.metadata = kw.get("metadata", None)
        self.name = kw.get("name", None)
        self.no1 = kw.get("no1", None)
        self.no2 = kw.get("no2", None)
        self.no3 = kw.get("no3", None)
        self.no4 = kw.get("no4", None)
        self.no5 = kw.get("no5", None)
        self.update_Ts = kw.get("update_Ts", None)
        self.weixin_id = kw.get("weixin_id", None)
        self.wx_id = kw.get("wx_id", None)


if __name__ == '__main__':
    BaseModel.createInitFunction(WeixinModel)
Example #3
0
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()
metadata = Base.metadata


class UserItem(Base, BM.BaseModel):
    __tablename__ = 'user_items'

    id = Column(INTEGER(11), primary_key=True)
    uid = Column(INTEGER(11))
    item_name = Column(String(60))
    item_content = Column(String(255))
    is_del = Column(TINYINT(1))
    create_ts = Column(INTEGER(11))
    update_ts = Column(INTEGER(11))

    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.item_content = kw.get("item_content", None)
        self.item_name = kw.get("item_name", None)
        self.metadata = kw.get("metadata", None)
        self.uid = kw.get("uid", None)
        self.update_ts = kw.get("update_ts", None)


if __name__ == '__main__':
    BM.createInitFunction(UserItem)
Example #4
0
# @Des       : SogouCookieModel
# @File        : SogouCookieModel
# @Software: PyCharm
import XX.Model.SqlAlchemy.BaseModel as BM
from sqlalchemy import Column, String
from sqlalchemy.dialects.mysql import INTEGER
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()
metadata = Base.metadata


class SogouCookieModel(Base, BM.BaseModel):
    __tablename__ = 'sogou_cookie'

    id = Column(INTEGER(11), primary_key=True)
    cookie = Column(String(64))
    create_ts = Column(INTEGER(11))
    times = Column(INTEGER(11))

    def __init__(self, *arg, **kw):
        self.cookie = kw.get("cookie", None)
        self.create_ts = kw.get("create_ts", None)
        self.id = kw.get("id", None)
        self.metadata = kw.get("metadata", None)
        self.times = kw.get("times", None)


if __name__ == '__main__':
    BM.createInitFunction(SogouCookieModel)
Example #5
0
        self.car_offical = kw.get("car_offical", 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.types = kw.get("types", None)
        self.uid = kw.get("uid", None)
        self.user_web_id = kw.get("user_web_id", None)
        self.update_ts = kw.get("update_ts", None)
        self.wb_comment_avg = kw.get("wb_comment_avg", None)
        self.wb_count_avg_per_month = kw.get("wb_count_avg_per_month", None)
        self.wb_like_avg = kw.get("wb_like_avg", None)
        self.wb_share_avg = kw.get("wb_share_avg", None)

    @staticmethod
    def setAbout(uid, session):
        import time
        exists = UserMore.getIdByKV("uid", uid, session)
        if exists:
            res = UserMore.updateKV(uid, "car_offical", 1, session)
        else:
            ts = int(time.time())
            umm = UserMore(car_offical=1, uid=uid, create_ts=ts)
            UserMore.addModel(umm, session)
            res = id
        return res


if __name__ == '__main__':
    BM.createInitFunction(UserMore)
Example #6
0
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()
metadata = Base.metadata


class ArticleContentModel(Base, BM.BaseModel):
    __tablename__ = 'article_content'

    id = Column(INTEGER(11), primary_key=True)
    article_id = Column(INTEGER(11))
    content = Column(Text)
    hash_key = Column(CHAR(32))
    is_del = Column(TINYINT(1))
    update_ts = Column(INTEGER(11))
    create_ts = Column(INTEGER(11))

    def __init__(self, *arg, **kw):
        self.article_id = kw.get("article_id", None)
        self.content = kw.get("content", None)
        self.create_ts = kw.get("create_ts", None)
        self.hash_key = kw.get("hash_key", None)
        self.id = kw.get("id", None)
        self.is_del = kw.get("is_del", None)
        self.metadata = kw.get("metadata", None)
        self.update_ts = kw.get("update_ts", None)


if __name__ == '__main__':
    BM.createInitFunction(ArticleContentModel)
Example #7
0
    type = Column(INTEGER(11), server_default=text("'0'"))
    is_del = Column(TINYINT(1))
    update_ts = Column(INTEGER(11))
    create_ts = Column(INTEGER(11))

    def __init__(self, *arg, **kw):
        self.article_url = kw.get("article_url", None)
        self.comment_count = kw.get("comment_count", None)
        self.copyright_stat = kw.get("copyright_stat", None)
        self.cover_url = kw.get("cover_url", None)
        self.create_ts = kw.get("create_ts", None)
        self.description = kw.get("description", None)
        self.id = kw.get("id", None)
        self.is_del = kw.get("is_del", None)
        self.like_count = kw.get("like_count", None)
        self.metadata = kw.get("metadata", None)
        self.msg_index = kw.get("msg_index", None)
        self.publish_time = kw.get("publish_time", None)
        self.qunfa_id = kw.get("qunfa_id", None)
        self.read_count = kw.get("read_count", None)
        self.read_more_url = kw.get("read_more_url", None)
        self.title = kw.get("title", None)
        self.type = kw.get("type", None)
        self.update_ts = kw.get("update_ts", None)
        self.weixin_url = kw.get("weixin_url", None)
        self.wx_id = kw.get("wx_id", None)


if __name__ == '__main__':
    BM.createInitFunction(ArticleModel)