diff --git a/data/database.py b/data/database.py index 5eec763..4b84eaf 100644 --- a/data/database.py +++ b/data/database.py @@ -4,15 +4,13 @@ The base definitions for database access and definition """ from datetime import datetime -import os - -from dotenv import load_dotenv from sqlalchemy import create_engine, Date, Integer, MetaData, String from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, sessionmaker +from util.environment import load_environment_variables -load_dotenv() +project_variables = load_environment_variables() """ Databse naming conventions. @@ -38,7 +36,7 @@ class DataAccessLayer: def __init__(self): self.engine = None - self.conn_string = os.getenv("DATABASE_URL") + self.conn_string = project_variables["LP_DATABASE_URL"] def connect(self): @@ -53,7 +51,7 @@ dal = DataAccessLayer() class PowerballDraw(Base): __tablename__ = 'powerball_draws' - draw_date: Mapped[datetime.date] = mapped_column(Date, primary_key=True) + draw_date: Mapped[datetime] = mapped_column(Date, primary_key=True) main_ball1: Mapped[int] = mapped_column(Integer) main_ball2: Mapped[int] = mapped_column(Integer) main_ball3: Mapped[int] = mapped_column(Integer) @@ -81,7 +79,7 @@ class PowerballDraw(Base): class MegaMillionsDraw(Base): __tablename__ = 'mega_millions_draws' - draw_date: Mapped[datetime.date] = mapped_column(Date, primary_key=True) + draw_date: Mapped[datetime] = mapped_column(Date, primary_key=True) main_ball1: Mapped[int] = mapped_column(Integer) main_ball2: Mapped[int] = mapped_column(Integer) main_ball3: Mapped[int] = mapped_column(Integer)