mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2025-11-30 13:20:40 +03:00
docker improvements
This commit is contained in:
@@ -27,7 +27,7 @@ class Settings(BaseSettings):
|
||||
"""
|
||||
|
||||
pg_user: str = os.getenv("SQL_USER", "")
|
||||
pg_pass: str = os.getenv("SQL_PASS", "")
|
||||
pg_pass: str = os.getenv("POSTGRES_PASSWORD", "")
|
||||
pg_host: str = os.getenv("SQL_HOST", "")
|
||||
pg_database: str = os.getenv("SQL_DB", "")
|
||||
pg_test_database: str = os.getenv("SQL_TEST_DB", "")
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from typing import Generator
|
||||
from typing import AsyncGenerator
|
||||
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
@@ -19,7 +20,7 @@ async_session = sessionmaker(engine, expire_on_commit=False, class_=AsyncSession
|
||||
|
||||
|
||||
# Dependency
|
||||
async def get_db() -> Generator:
|
||||
async def get_db() -> AsyncGenerator:
|
||||
session = async_session()
|
||||
try:
|
||||
yield session
|
||||
|
||||
Reference in New Issue
Block a user