blob: 0a70906d8641fe5537e66e4539f5d809a2c848d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
import os.path
import sqlite3
# Check if database exist
if os.path.exists('data/db/bazarr.db') == True:
pass
else:
# Get SQL script from file
fd = open('create_db.sql', 'r')
script = fd.read()
# Open database connection
db = sqlite3.connect('data/db/bazarr.db')
c = db.cursor()
# Execute script and commit change to database
c.executescript(script)
# Close database connection
db.close()
# Close SQL script file
fd.close()
|