-
Notifications
You must be signed in to change notification settings - Fork 1
/
build_db.py
20 lines (20 loc) · 699 Bytes
/
build_db.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import sqlite3
conn = sqlite3.connect(r"db/lexicon.db")
cursor = conn.cursor()
query = 'DROP TABLE IF EXISTS lexicon;'
cursor.execute(query)
query = 'DROP TABLE IF EXISTS mention_uris;'
cursor.execute(query)
query = 'DROP TABLE IF EXISTS entities;'
cursor.execute(query)
query = 'DROP TABLE IF EXISTS categories;'
cursor.execute(query)
with open('queries/create_mention_uris_table.sql', 'r') as query_file:
query = query_file.read()
cursor.execute(query)
with open('queries/create_categories_table.sql', 'r') as query_file:
query = query_file.read()
cursor.execute(query)
with open('queries/create_entities_table.sql', 'r') as query_file:
query = query_file.read()
cursor.execute(query)