21 lines
667 B
Python
21 lines
667 B
Python
from typing import AsyncGenerator
|
|
|
|
from sqlalchemy import create_engine, select
|
|
# from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine
|
|
from sqlalchemy.orm import sessionmaker, Session
|
|
from sqlalchemy.ext.declarative import declarative_base
|
|
|
|
from fastapi import Depends
|
|
# from fastapi_users.db import SQLAlchemyBaseUserTableUUID, SQLAlchemyUserDatabase
|
|
|
|
|
|
SQLALCHEMY_DATABASE_URL = "sqlite:///./sql_app.db"
|
|
|
|
engine = create_engine(
|
|
SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False}
|
|
)
|
|
|
|
SessionLocal = sessionmaker(bind=engine, autoflush=True, autocommit=False)
|
|
|
|
database = SessionLocal()
|
|
Base = declarative_base() |