class Task(AuthModel): __table__ = 'grab_task' aid = baseorm.IdField() fid = baseorm.IdField() sid = baseorm.IdField() name = baseorm.StrField(ddl='varchar', max_length=50, searchable='in') params = baseorm.StrField(ddl='varchar', default=None, max_length=3000) worknum = baseorm.IntField(ddl='int', max_length=3) queuetype = baseorm.StrField(ddl='char', max_length=1) worktype = baseorm.StrField(ddl='varchar', max_length=30) timeout = baseorm.IntField(ddl='int', max_length=4) category = baseorm.StrField(ddl='varchar', max_length=50) tag = baseorm.StrField(ddl='varchar', default=None, max_length=500) type = baseorm.StrField(ddl='varchar', max_length=8) push_url = baseorm.StrField(ddl='varchar', max_length=100) period = baseorm.IntField(ddl='int', max_length=4) status = baseorm.IntField(ddl='int', default=1, max_length=1) state = baseorm.IntField(ddl='int', default=0, max_length=1) count = baseorm.IntField(ddl='int', max_length=5) extra = baseorm.StrField(ddl='varchar', max_length=300, default=None, searchable='in') creator = baseorm.IdField(updatable=False) updator = baseorm.IdField() create_time = baseorm.DatetimeField(ddl='datetime', updatable=False) update_time = baseorm.DatetimeField(ddl='timestamp')
class Section(AuthModel): __table__ = 'grab_section' aid = baseorm.IdField(unique='gs') fid = baseorm.IdField(unique='gs') next_id = baseorm.IdField() name = baseorm.StrField(ddl='varchar', max_length=20, nullable=0, updatable=False, unique='gs') desc = baseorm.StrField(ddl='char', max_length=128) step = baseorm.IntField(ddl='int', max_length=2) flow = baseorm.StrField(ddl='varchar', max_length=20, nullable=0, updatable=False, unique='gs') index = baseorm.StrField(ddl='varchar', max_length=20) retry = baseorm.IntField(ddl='int', max_length=1) timelimit = baseorm.IntField(ddl='int', max_length=4) store = baseorm.IntField(ddl='int', max_length=1) additions = baseorm.StrField(ddl='varchar', max_length=1024, default=None) extra = baseorm.StrField(ddl='varchar', max_length=300, default=None) creator = baseorm.IdField(updatable=False) updator = baseorm.IdField() create_time = baseorm.DatetimeField(ddl='datetime', updatable=False) update_time = baseorm.DatetimeField(ddl='timestamp')
class Flow(AuthModel): __table__ = 'grab_flow' aid = baseorm.IdField() name = baseorm.StrField(ddl='varchar', max_length=20, nullable=0, updatable=False, unique='gf') desc = baseorm.StrField(ddl='varchar', max_length=128, default=None) status = baseorm.IntField(ddl='int', max_length=1) creator = baseorm.IdField(updatable=False) updator = baseorm.IdField() create_time = baseorm.DatetimeField(ddl='datetime', updatable=False) update_time = baseorm.DatetimeField(ddl='timestamp')
class MarkModel(dataorm.Model): create_time = dataorm.DatetimeField(ddl='datetime', updatable=False) update_time = dataorm.DatetimeField(ddl='timestamp') tid = baseorm.IdField(unique='data', updatable=False) def __init__(self, **attributes): # self.__mappings__['create_time'] = dataorm.DatetimeField(ddl='datetime') # self.__mappings__['update_time'] = dataorm.DatetimeField(ddl='datetime') # self.__mappings__['tid'] = baseorm.IdField(unique='data', updatable=False) attributes['create_time'] = attributes.get('create_time', datetime.datetime.now()) attributes['update_time'] = attributes.get('update_time', datetime.datetime.now()) for key in self.__mappings__: if key == '_id' and not key in attributes: continue if not key in attributes: raise Exception('Need field %s. ' % key) attributes[key] = self.__mappings__[key].check_value( attributes[key]) super(MarkModel, self).__init__(**attributes) def __setstate__(self, state): self.__dict__ = state def __getstate__(self): return self.__dict__
class Unit(AuthModel): __table__ = 'grab_unit' dmid = baseorm.IdField() name = baseorm.StrField(ddl='varchar', max_length=20, nullable=0, updatable=False, unique='gu') desc = baseorm.StrField(ddl='char', max_length=128) filepath = baseorm.StrField(ddl='varchar', max_length=64) digest = baseorm.StrField(ddl='char', max_length=32, default=None) status = baseorm.IntField(ddl='int', max_length=1) extra = baseorm.StrField(ddl='varchar', max_length=300, default=None) creator = baseorm.IdField(updatable=False) updator = baseorm.IdField() create_time = baseorm.DatetimeField(ddl='datetime', updatable=False) update_time = baseorm.DatetimeField(ddl='timestamp')
class Permit(baseorm.Model): __table__ = 'grab_permit' cid = baseorm.IdField(unique='gp') oid = baseorm.IdField(unique='gp', default=None) otype = baseorm.StrField(ddl='varchar', max_length=50, nullable=0, updatable=False, unique='gp') authority = baseorm.IntField(ddl='int', max_length=3) desc = baseorm.StrField(ddl='char', max_length=4) status = baseorm.IntField(ddl='int', max_length=1) extra = baseorm.StrField(ddl='varchar', max_length=300, default=None) creator = baseorm.IdField(updatable=False) updator = baseorm.IdField() create_time = baseorm.DatetimeField(ddl='datetime', updatable=False) update_time = baseorm.DatetimeField(ddl='timestamp')
class Datamodel(AuthModel): __table__ = 'grab_datamodel' name = baseorm.StrField(ddl='varchar', max_length=64, nullable=0, updatable=False, unique='gdm') table = baseorm.StrField(ddl='varchar', max_length=64) comment = baseorm.StrField(ddl='varchar', max_length=128) filepath = baseorm.StrField(ddl='varchar', max_length=64) digest = baseorm.StrField(ddl='char', max_length=32, default=None) status = baseorm.IntField(ddl='int', max_length=1) extra = baseorm.StrField(ddl='varchar', max_length=300, default=None) creator = baseorm.IdField(updatable=False) updator = baseorm.IdField() create_time = baseorm.DatetimeField(ddl='datetime', updatable=False) update_time = baseorm.DatetimeField(ddl='timestamp')
class Log(dataorm.Model): __table__ = 'grab_log' _id = dataorm.StrField(ddl='varchar', max_length=32, primary=True) tid = baseorm.IdField(updatable=False) status = dataorm.StrField(ddl='varchar', max_length=8) elapse = dataorm.IntField(ddl='float') desc = dataorm.StrField(ddl='varchar', default=None, max_length=1280) create_time = dataorm.DatetimeField(ddl='datetime', updatable=False)
class Logsummary(dataorm.Model): __table__ = 'grab_logsummary' tid = baseorm.IdField(updatable=False) succ = dataorm.IntField(ddl='int', max_length=10) fail = dataorm.IntField(ddl='int', max_length=10) timeout = dataorm.IntField(ddl='int', max_length=10) elapse = dataorm.FloatField(ddl='float') create_time = dataorm.DatetimeField(ddl='datetime', updatable=False)
class ProxyStatistics(dataorm.Model): __table__ = 'grab_proxy_statistics' pid = baseorm.IdField(updatable=False) avg_elapse = dataorm.FloatField(ddl='float') total_elapse = dataorm.FloatField(ddl='float') start_time = dataorm.DatetimeField(ddl='datetime', updatable=False) end_time = dataorm.DatetimeField(ddl='datetime', updatable=False) create_time = dataorm.DatetimeField(ddl='datetime', updatable=False) update_time = dataorm.DatetimeField(ddl='timestamp')
class Article(AuthModel): __table__ = 'grab_article' uid = baseorm.IdField(unique='ga') name = baseorm.StrField(ddl='varchar', max_length=20, nullable=0, updatable=False, unique='ga', searchable='end') desc = baseorm.StrField(ddl='char', max_length=128, searchable='in') clsname = baseorm.StrField(ddl='varchar', max_length=50, searchable='end') filepath = baseorm.StrField(ddl='varchar', max_length=64) digest = baseorm.StrField(ddl='char', max_length=32, default=None) status = baseorm.IntField(ddl='int', max_length=1) extra = baseorm.StrField(ddl='varchar', max_length=300, default=None) creator = baseorm.IdField(updatable=False) updator = baseorm.IdField() create_time = baseorm.DatetimeField(ddl='datetime', updatable=False) update_time = baseorm.DatetimeField(ddl='timestamp')
class Creator(AuthModel): __table__ = 'grab_creator' username = baseorm.StrField(ddl='varchar', max_length=20, nullable=0, updatable=False, unique='gc', searchable='in') password = baseorm.StrField(ddl='varchar', max_length=20) group = baseorm.StrField(ddl='varchar', max_length=20, searchable='all') desc = baseorm.StrField(ddl='varchar', max_length=128) avatar = baseorm.StrField(ddl='varchar', max_length=128) contact = baseorm.StrField(ddl='varchar', default=None, max_length=500) notify = baseorm.StrField(ddl='varchar', max_length=100) status = baseorm.IntField(ddl='int', max_length=1) extra = baseorm.StrField(ddl='varchar', max_length=300, default=None) secret = baseorm.StrField(ddl='varchar', max_length=100) creator = baseorm.IdField(updatable=False) updator = baseorm.IdField() create_time = baseorm.DatetimeField(ddl='datetime', updatable=False) update_time = baseorm.DatetimeField(ddl='timestamp')
class Shop(dataorm.Model): __table__ = 'shop' food_id = dataorm.ListField(ddl='list', comment='食物id') name = dataorm.StrField(ddl='varchar', max_length=50, comment='食物名称') desc = dataorm.StrField(ddl='varchar', max_length=640, comment='描述') tel = dataorm.StrField(ddl='varchar', max_length=50, comment='电话') pic = dataorm.ListField(ddl='list', comment='店面图片') province_id = dataorm.StrField(ddl='varchar', max_length=50, comment='省份id') city_id = dataorm.StrField(ddl='varchar', max_length=50, comment='城市id') tag = dataorm.ListField(ddl='list', comment='标签') area_id = dataorm.StrField(ddl='varchar', max_length=50, comment='区域id') town_id = dataorm.StrField(ddl='varchar', max_length=50, comment='镇id') country_id = dataorm.StrField(ddl='varchar', max_length=50, comment='国家id') address = dataorm.StrField(ddl='varchar', max_length=250, comment='地址') longitude = dataorm.StrField(ddl='float', comment='经度') latitude = dataorm.StrField(ddl='float', comment='纬度') dianping = dataorm.DictField(ddl='dict', comment='点评数据') src = dataorm.StrField(ddl='varchar', unique='data', max_length=20, comment='来源') link_url = dataorm.StrField(ddl='varchar', unique='data', max_length=20, comment='来源页面地址') # { # 'url': '', # 'star': 0, # 'average': 0, # 'taste': 0, # 'env': 0, # 'service': 0, # } atime = dataorm.DatetimeField(ddl='datetime', comment='店面创建时间') time = dataorm.DatetimeField(ddl='datetime', updatable=False, comment='时间') uptime = dataorm.DatetimeField(ddl='timestamp', comment='更新时间') tid = baseorm.IdField(unique='data', updatable=False)