-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmerge.py
36 lines (29 loc) · 941 Bytes
/
merge.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
import sqlite3
## open the two databases
conn = sqlite3.connect("main.db")
questions = sqlite3.connect("cleaned.db")
## get the cursor
cur = conn.cursor()
cur2 = questions.cursor()
def merge():
# create the database in main.db
cur.execute("""
CREATE TABLE IF NOT EXISTS sat_questions (
questionId TEXT PRIMARY KEY NOT NULL,
id TEXT NOT NULL,
test TEXT NOT NULL,
category TEXT NOT NULL,
domain TEXT NOT NULl,
skill TEXT NOT NULL,
difficulty TEXT NOT NULL,
details TEXT,
question TEXT NOT NULL,
answer_choices TEXT,
answer TEXT NOT NULL,
rationale TEXT NOT NULL
)""")
cur2.execute("SELECT * FROM sat_questions")
rows = cur2.fetchall()
cur.executemany("INSERT INTO sat_questions VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", rows)
conn.commit()
merge()