import psycopg2 from peewee import * # from psycopg2.psycopg1 import connection # from psycopg2.psycopg1 import connection from psycopg2.extras import DictCursor # from twisted.conch.scripts.conch import conn # cursor = conn.cursor(cursor_factory=DictCursor) # connection.cursor() database = PostgresqlDatabase('kaiyou',**{'host': '192.168.2.200', 'port': 10432, 'user': 'kaiyou', 'password': '123456'}) # database = PostgresqlDatabase('postgres', **{'host': '127.0.0.1', 'port': 5432, 'user': 'postgres', 'password': '9998877'}) class UnknownField(object): def __init__(self, *_, **__): pass class BaseModel(Model): class Meta: pass database = database class StZqOdds(BaseModel): condition = CharField(constraints=[SQL("DEFAULT ''::character varying")]) ctime = DateTimeField() expire_time = DateTimeField(null=True) id = BigIntegerField(constraints=[SQL("DEFAULT nextval('st_zq_odds_id_seq'::regclass)")]) lg_id = IntegerField(constraints=[SQL("DEFAULT 0")]) match_id = BigIntegerField(constraints=[SQL("DEFAULT 0")]) max = FloatField(constraints=[SQL("DEFAULT 99")]) min = FloatField(constraints=[SQL("DEFAULT 0")]) odds = FloatField() odds_code = CharField(constraints=[SQL("DEFAULT ''::character varying")]) odds_only = CharField(constraints=[SQL("DEFAULT ''::character varying")]) p_code = CharField(constraints=[SQL("DEFAULT ''::character varying")]) p_id = BigIntegerField(constraints=[SQL("DEFAULT '-1'::integer")]) sole = CharField(constraints=[SQL("DEFAULT ''::character varying")], unique=True) sort = IntegerField(constraints=[SQL("DEFAULT 0")]) source = CharField(constraints=[SQL("DEFAULT ''::character varying")]) status = IntegerField(constraints=[SQL("DEFAULT 0")]) team = CharField(constraints=[SQL("DEFAULT ''::character varying")]) type = IntegerField(constraints=[SQL("DEFAULT 0")]) utime = DateTimeField() class Meta: table_name = 'st_zq_odds' primary_key = False #赔率记录表 class StZqOddsRecord(BaseModel): condition = CharField(constraints=[SQL("DEFAULT ''::character varying")]) ctime = DateTimeField(null=True) id = BigIntegerField(constraints=[SQL("DEFAULT nextval('st_zq_odds_record_id_seq'::regclass)")]) lg_id = IntegerField(constraints=[SQL("DEFAULT 0")]) match_id = BigIntegerField(constraints=[SQL("DEFAULT 0")]) max = FloatField(constraints=[SQL("DEFAULT 99")]) min = FloatField(constraints=[SQL("DEFAULT 0")]) odds = FloatField() odds_code = CharField(constraints=[SQL("DEFAULT ''::character varying")]) odds_only = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True) p_code = CharField(constraints=[SQL("DEFAULT ''::character varying")]) p_id = BigIntegerField(constraints=[SQL("DEFAULT '-1'::integer")]) sort = IntegerField(constraints=[SQL("DEFAULT 0")]) source = CharField(constraints=[SQL("DEFAULT ''::character varying")]) status = IntegerField(constraints=[SQL("DEFAULT 0")]) team = CharField(constraints=[SQL("DEFAULT ''::character varying")]) type = IntegerField(constraints=[SQL("DEFAULT 0")]) utime = DateTimeField(null=True) class Meta: table_name = 'st_zq_odds_record' primary_key = False class StZqResult(BaseModel): all_goal = IntegerField(constraints=[SQL("DEFAULT 0")]) first_score = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True) guest_rate = FloatField(constraints=[SQL("DEFAULT 0")]) guest_score = IntegerField(constraints=[SQL("DEFAULT 0")]) guest_team = CharField() home_rate = FloatField(constraints=[SQL("DEFAULT 0")]) home_score = IntegerField(constraints=[SQL("DEFAULT 0")]) home_team = CharField() last_score = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True) lg_id = IntegerField() match_id = BigIntegerField() match_process = CharField() match_score = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True) match_time = CharField() match_winer = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True) source = CharField(null=True) status = IntegerField(constraints=[SQL("DEFAULT 0")]) tag = IntegerField(constraints=[SQL("DEFAULT 0")]) u_guest_score = IntegerField(constraints=[SQL("DEFAULT 0")]) u_home_score = IntegerField(constraints=[SQL("DEFAULT 0")]) update_time = DateTimeField() class Meta: table_name = 'st_zq_result' class StZqResultRecord(BaseModel): all_goal = IntegerField(constraints=[SQL("DEFAULT 0")], null=True) first_score = CharField(null=True) guest_rate = FloatField(constraints=[SQL("DEFAULT 0")], null=True) guest_score = IntegerField(constraints=[SQL("DEFAULT 0")], null=True) guest_team = CharField() home_rate = FloatField(constraints=[SQL("DEFAULT 0")], null=True) home_score = IntegerField(constraints=[SQL("DEFAULT 0")], null=True) home_team = CharField() last_score = CharField(null=True) lg_id = BigIntegerField() match_id = BigIntegerField() match_process = CharField() match_score = CharField(null=True) match_time = CharField() match_winer = CharField(null=True) source = CharField(null=True) status = IntegerField() tag = IntegerField(null=True) update_time = DateTimeField() class Meta: table_name = 'st_zq_result_record' class StZqCompetition(BaseModel): ctime = DateTimeField(null=True) expire_time = DateTimeField(null=True) guest_team = CharField() home_team = CharField() is_morningplate = IntegerField(constraints=[SQL("DEFAULT 0")], null=True) is_rollball = IntegerField(constraints=[SQL("DEFAULT 0")], null=True) is_stringscene = IntegerField(constraints=[SQL("DEFAULT 0")], null=True) is_today = IntegerField(constraints=[SQL("DEFAULT 0")], null=True) lg_id = IntegerField(constraints=[SQL("DEFAULT 0")], null=True) match_date = DateField(null=True) match_id = BigIntegerField(constraints=[SQL("DEFAULT 0")], null=True, unique=True) match_time = TimeField(null=True) recommend = CharField(constraints=[SQL("DEFAULT '0'")], null=True) sg_id = IntegerField(constraints=[SQL("DEFAULT 0")], null=True) source = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True) status = CharField(constraints=[SQL("DEFAULT '0'")], null=True) tag = IntegerField(constraints=[SQL("DEFAULT 0")], null=True) type = IntegerField(constraints=[SQL("DEFAULT 0")], null=True) utime = DateTimeField(null=True) class Meta: table_name = 'st_zq_competition' #联赛表 class StZqLeague(BaseModel): area_id = IntegerField(constraints=[SQL("DEFAULT 0")]) begin_season = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True) bf_ifdisplay = IntegerField(column_name='bf_Ifdisplay', constraints=[SQL("DEFAULT 0")], null=True) count_round = BigIntegerField(constraints=[SQL("DEFAULT '1'::bigint")]) country_id = IntegerField(constraints=[SQL("DEFAULT 0")]) curr_round = BigIntegerField(constraints=[SQL("DEFAULT 0")], null=True) hot = IntegerField(constraints=[SQL("DEFAULT 0")], null=True) id = BigAutoField() if_have_sub = IntegerField(constraints=[SQL("DEFAULT 0")], null=True) if_stop = IntegerField(constraints=[SQL("DEFAULT 0")], null=True) kind = IntegerField(constraints=[SQL("DEFAULT '1'::bigint")]) last_time = DateTimeField(null=True) league_list = BigIntegerField(constraints=[SQL("DEFAULT 0")], null=True) league_pic = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True) lg_id = BigIntegerField(constraints=[SQL("DEFAULT 0")], unique=True) match_mode = IntegerField(constraints=[SQL("DEFAULT '1'::bigint")]) match_season = CharField(constraints=[SQL("DEFAULT 'NULL::bpchar'")], null=True) name_chinese = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True) name_english = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True) source = CharField(null=True) class Meta: table_name = 'st_zq_league'