Skip to main content
Glama
hsgui
by hsgui
database.py826 B
from __future__ import annotations from collections.abc import Generator from sqlalchemy import create_engine from sqlalchemy.orm import DeclarativeBase, Session, sessionmaker from app.core.config import get_settings class Base(DeclarativeBase): """Base declarative class shared by all ORM models.""" settings = get_settings() connect_args = {"check_same_thread": False} if settings.database_url.startswith("sqlite") else {} engine = create_engine(settings.database_url, connect_args=connect_args) SessionLocal = sessionmaker(bind=engine, autoflush=False, autocommit=False, expire_on_commit=False) def get_session() -> Generator[Session, None, None]: """Provide a SQLAlchemy session for request scope usage.""" session = SessionLocal() try: yield session finally: session.close()

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hsgui/daily-work-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server