-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb.py
executable file
·38 lines (32 loc) · 1.15 KB
/
db.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#coding=gbk
'''
Created on 2015Äê11ÔÂ5ÈÕ
@author: ´óÐÛ
'''
from peewee import *
import peewee
import datetime
database = peewee.MySQLDatabase(host = '192.168.46.106', user = 'root', passwd = 'root.com', database = 'bi', charset = 'utf8')
class BaiduDailyVisit(Model):
visit_date = DateField()
pv_count = DecimalField(max_digits=10)
uv_count = DecimalField(max_digits=10)
ip_count = DecimalField(max_digits=10)
bounce_rate = DecimalField(max_digits=10,decimal_places=4)
visit_time_avg = CharField(max_length=20)
create_time = DateTimeField(default=datetime.datetime.now)
src_sys = CharField(max_length=20,null=True)
class Meta:
db_table = 'bi_dm_baidu_visit_by_day'
database = database
class ScheduleLog(Model):
job_name = CharField(max_length=50,null=True)
create_time = DateTimeField(default=datetime.datetime.now)
status = CharField(max_length=20,null=True)
desc = TextField(null=True)
class Meta:
db_table = 'bi_schedule_log'
database = database
if __name__ == '__main__':
database.connect()
database.create_tables([ScheduleLog])