Created database creation scipts
This commit is contained in:
24
scripts/create_database.py
Normal file
24
scripts/create_database.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import sqlite3
|
||||
from sqlite3 import Error
|
||||
|
||||
|
||||
def create_connection(db_file):
|
||||
""" create a database connection to a SQLite database """
|
||||
conn = None
|
||||
try:
|
||||
conn = sqlite3.connect(db_file)
|
||||
|
||||
# Execute creation scripts
|
||||
sql = open("create_tables.sql", "r");
|
||||
conn.executescript(sql.read())
|
||||
|
||||
print(sqlite3.version)
|
||||
except Error as e:
|
||||
print(e)
|
||||
finally:
|
||||
if conn:
|
||||
conn.close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
create_connection(r"../data/wmgzon.db")
|
||||
Reference in New Issue
Block a user