mirror of
https://github.com/kevin-DL/full-stack-fastapi-postgresql.git
synced 2026-01-12 10:15:12 +00:00
* Use Pydantic BaseSettings for config settings * Update fastapi dep to >=0.47.0 and email_validator to email-validator * Fix deprecation warning for Pydantic >=1.0 * Properly support old-format comma separated strings for BACKEND_CORS_ORIGINS Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
11 lines
376 B
Python
11 lines
376 B
Python
from sqlalchemy import create_engine
|
|
from sqlalchemy.orm import scoped_session, sessionmaker
|
|
|
|
from app.core.config import settings
|
|
|
|
engine = create_engine(settings.SQLALCHEMY_DATABASE_URI, pool_pre_ping=True)
|
|
db_session = scoped_session(
|
|
sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
|
)
|
|
Session = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|