Files
lanhongguangandClaude Sonnet 4.6 f5a6dcb585 feat: 初始化 SIM 卡管理平台
支持多 USB 4G 模块管理、实时信号监控、短信收发及定时自动发送任务。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-21 18:08:13 +08:00

22 lines
491 B
Python

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, DeclarativeBase
from app.core.config import settings
engine = create_engine(
settings.DATABASE_URL,
connect_args={"check_same_thread": False} if "sqlite" in settings.DATABASE_URL else {},
)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
class Base(DeclarativeBase):
pass
def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close()