Files
agon/utilities/sql_data_classes.py
T

21 lines
592 B
Python

"""
Simple file to set up the sqlalchemy connection to database.
"""
from sqlalchemy import create_engine
from sqlalchemy.ext.automap import automap_base
# pylint: disable=import-error
from utilities import config
# connect with sql alchemy and autoload schema
url = f"mysql://{config.SQL_USER}:{config.SQL_PASS}@{config.SQL_HOST}/{config.SQL_DB}"
engine = create_engine(url)
Base = automap_base()
Base.prepare(autoload_with=engine)
# define the classes
Guild = Base.classes.Guilds
CategoryGroup = Base.classes.CategoryGroups
Category = Base.classes.Categories
Score = Base.classes.Scores