Change varible import to new util function

This commit is contained in:
chris committed 2026-03-04 20:09:25 -05:00
1 parent 16dd4ad287
commit 1dbcb252e3
1 file changed
+5 -7
+5 -7
View File
@@ -4,15 +4,13 @@
The base definitions for database access and definition The base definitions for database access and definition
""" """
from datetime import datetime from datetime import datetime
import os
from dotenv import load_dotenv
from sqlalchemy import create_engine, Date, Integer, MetaData, String from sqlalchemy import create_engine, Date, Integer, MetaData, String
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, sessionmaker 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. Databse naming conventions.
@@ -38,7 +36,7 @@ class DataAccessLayer:
def __init__(self): def __init__(self):
self.engine = None self.engine = None
self.conn_string = os.getenv("DATABASE_URL") self.conn_string = project_variables["LP_DATABASE_URL"]
def connect(self): def connect(self):
@@ -53,7 +51,7 @@ dal = DataAccessLayer()
class PowerballDraw(Base): class PowerballDraw(Base):
__tablename__ = 'powerball_draws' __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_ball1: Mapped[int] = mapped_column(Integer)
main_ball2: Mapped[int] = mapped_column(Integer) main_ball2: Mapped[int] = mapped_column(Integer)
main_ball3: Mapped[int] = mapped_column(Integer) main_ball3: Mapped[int] = mapped_column(Integer)
@@ -81,7 +79,7 @@ class PowerballDraw(Base):
class MegaMillionsDraw(Base): class MegaMillionsDraw(Base):
__tablename__ = 'mega_millions_draws' __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_ball1: Mapped[int] = mapped_column(Integer)
main_ball2: Mapped[int] = mapped_column(Integer) main_ball2: Mapped[int] = mapped_column(Integer)
main_ball3: Mapped[int] = mapped_column(Integer) main_ball3: Mapped[int] = mapped_column(Integer)