-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDBDao.py
More file actions
25 lines (24 loc) · 776 Bytes
/
Copy pathDBDao.py
File metadata and controls
25 lines (24 loc) · 776 Bytes
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
#!usr/bin/python
#-*- coding:UTF-8 -*-
import pymysql as MySQLdb
def getConnectDB():
db=MySQLdb.connect('127.0.0.1','root','demo','youtubeclub',charset='utf8')
return db
def initDownloadLog():
db=getConnectDB()
cursor=db.cursor()
createSql="""create table if not exists download_log(videoid varchar(50) not null primary key ,videotitle TEXT,videofilename Text,downloaddate datetime,fornumname,fornumid,isDelete char(5))
"""
cursor.execute(createSql)
db.commit()
db.close()
return
def initScrapyRecord():
db=getConnectDB()
cursor=db.cursor()
initSql="""create table if not exists Scrapy_Record(scrapyUrl TEXT,fornumname varchar(500)
,isEnable char(5))"""
cursor.execute(initSql)
db.commit()
db.close()
return