Building the database using sql file

This commit is contained in:
2025-04-02 15:11:46 -04:00
parent fa870f3f54
commit c78aa38db9
8 changed files with 642 additions and 34 deletions

View File

@@ -4,6 +4,15 @@ class Database:
def __init__(self, database_file):
self.db = sqlite3.connect(database_file)
def build_database(self, sql_file_path):
sql_script_string = ''
with open(sql_file_path, 'r') as sql_file:
sql_script_string = sql_file.read()
cursor = self.db.cursor()
cursor.executescript(sql_script_string)
self.db.commit()
def select(self, index):
# Query the database for the specified index
cursor = self.db.cursor()