migrate to using db connection string from env
This commit is contained in:
parent
84a55eefde
commit
efe3248c07
9 changed files with 375 additions and 177 deletions
|
|
@ -1,9 +1,13 @@
|
|||
import os
|
||||
from sqlmodel import create_engine, SQLModel
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
|
||||
# PostgreSQL example (or use "sqlite:///database.db" for SQLite)
|
||||
# DATABASE_URL = "postgresql://user:password@localhost/db_name"
|
||||
DATABASE_URL = "sqlite:///data/wrongmove.db"
|
||||
# DATABASE_URL = "sqlite:///data/wrongmove.db"
|
||||
# DATABASE_URL = "mysql://wrongmove:wrongmove@localhost:3306/wrongmove"
|
||||
DATABASE_URL = os.environ["DB_CONNECTION_STRING"]
|
||||
|
||||
|
||||
engine = create_engine(DATABASE_URL, echo=False) # `echo=True` for debug logs
|
||||
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue