commit3627419e12Merge:2db744d3446ce9Author: alwayscompiling <[email protected]> Date: Tue Dec 6 22:36:51 2022 -0500 Merge branch '45-sql-connection-timing-out' into develop commit3446ce9ca2Author: alwayscompiling <[email protected]> Date: Tue Dec 6 22:27:05 2022 -0500 Change session usage to on use basis. commit2db744d170Author: alwayscompiling <[email protected]> Date: Sun Dec 4 21:44:54 2022 -0500 Add restart policy. commitfa33be1b4aAuthor: alwayscompiling <[email protected]> Date: Sun Dec 4 21:25:57 2022 -0500 Renamed docker compose file.
21 lines
592 B
Python
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
|