import sqlite3 def create_connection(db_file): """ create a database connection to a SQLite database """ conn = None try: print("Opening Database file and ensuring table integrity") conn = sqlite3.connect(db_file) # Execute creation scripts sql = open("scripts/create_tables.sql", "r"); conn.executescript(sql.read()) print("SQLite Version: " + sqlite3.version) print("Table creation complete") except sqlite3.Error as e: print(e) finally: if conn: conn.close() if __name__ == '__main__': create_connection(r"./data/wmgzon.db")