#------------------------------------------
#--- Author: Yomara Acevedo
#--- Date: 24 April 2017
#--- Purpose: Create database for storing statistics tables
#--- Python Ver: 2.7
#--- Modified from: Pradeep Singh
#--- Details At: https://iotbytes.wordpress.com/store-mqtt-data-from-sensors-into-sql-database/
#------------------------------------------

import json
import sqlite3

# SQLite DB name
DB_Name = "SuddenDeath.db"
TableSchema="""
drop table if exists suddeathTest;
create table suddeath (
    id integer primary key autoincrement,
    Variable text
);
"""

conn = sqlite3.connect(DB_Name)
curs = conn.cursor()

sqlite3.complete_statement(TableSchema)
curs.executescript(TableSchema)

curs.close()
conn.close()
