Add sqlalchemy connection to database. Store election information.

This commit is contained in:
2023-07-16 22:54:04 -04:00
parent fc9eb7b151
commit e5e638edc9
6 changed files with 40 additions and 12 deletions
+16
View File
@@ -0,0 +1,16 @@
"""
Simple file to set up the sqlalchemy connection to database.
"""
from sqlalchemy import create_engine
from sqlalchemy.ext.automap import automap_base
# connect with sql alchemy and autoload schema
URL = "sqlite+pysqlite:///dakiny.db"
engine = create_engine(URL)
Base = automap_base()
Base.prepare(autoload_with=engine)
# define the classes
ElectionInformation = Base.classes.ElectionInformation
CouncilMembers = Base.classes.CouncilMembers
Votes = Base.classes.Votes