from typing import AsyncGenerator from sqlalchemy import create_engine, MetaData # from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine from sqlalchemy.orm import sessionmaker, DeclarativeBase from sqlalchemy.ext.declarative import declarative_base 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() # # add your model's MetaData object here # # for 'autogenerate' support # # in your application's model: # class Base(DeclarativeBase): # metadata = MetaData(naming_convention={ # "ix": "ix_%(column_0_label)s", # "uq": "uq_%(table_name)s_%(column_0_name)s", # "ck": "ck_%(table_name)s_`%(constraint_name)s`", # "fk": "fk_%(table_name)s_%(column_0_name)s_%(referred_table_name)s", # "pk": "pk_%(table_name)s" # })