from datetime import datetime
from sqlmodel import Session, SQLModel, create_engine, text
import sqlite3

database_loc = "backend/database.sqlite"
con_str = f"sqlite:///{database_loc}"

engine = create_engine(con_str, echo=True)
sqlite3_engine = sqlite3.connect(f"{database_loc}")


def get_session():
    session = Session(engine)
    return session


def create_db():
    SQLModel.metadata.create_all(engine)


def execute_sample_sql(session):
    """Read sample sql database and import it."""
    with open("backend/tests/sample.sql") as f:
        content = f.read()

    queries = filter(None, content.split(";\n"))
    queries = [