-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreate_db.py
44 lines (34 loc) · 885 Bytes
/
create_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
39
40
41
42
43
44
#!/usr/local/bin/python3
# coding: utf-8
# BagAndDrag - create_db.py
# 1/10/21 15:23
#
__author__ = "Benny <[email protected]>"
import pymysql
con = pymysql.Connect(host="127.0.0.1", user="root", password="root", charset="utf8mb4")
sql = [
"CREATE DATABASE yyets CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;",
"use yyets",
"""
create table resource
(
id int primary key,
url varchar(255) null unique ,
name text null,
expire int null,
expire_cst varchar(255) null,
data longtext null
)charset utf8mb4;
""",
"""
create table failure
(
id int primary key not null,
traceback longtext null
)charset utf8mb4;
""",
]
cur = con.cursor()
for s in sql:
cur.execute(s)
con.close()