Python 508 FILES 8 FINDINGS

HOW SQLMODEL
ACTUALLY WORKS

SQL databases in Python, designed for simplicity and compatibility with FastAPI. Conventions, patterns, and architecture extracted from the fastapi/sqlmodel repository by sourcebook.

QUICK_REF:
Routing: FastAPI endpoints Testing: pytest.

WHAT_MATTERS

  • Uses FastAPI endpoints for routing — follow this pattern, don't add REST routes directly

KEY_FINDINGS

FastAPI project. Use Pydantic models for request/response schemas, not raw dicts.

HIGH

Uses SQLAlchemy/SQLModel for ORM. Database sessions must be properly closed (use dependency injection).

HIGH

Uses pytest. Test files should be named `test_*.py` or `*_test.py`.

HIGH

Tests live in a separate test/ directory, mirroring src/ structure. New tests go there, not next to source files.

HIGH

API endpoints use FastAPI endpoints. Follow this pattern for new routes.

HIGH
14 files use FastAPI endpoints

Tests use pytest.

HIGH
20 test files

Route definitions live in: docs_src/tutorial/fastapi, docs_src/tutorial/fastapi/update, docs_src/tutorial/fastapi/teams. Add new endpoints here.

HIGH
3 route directories
GENERATED IN ~3 SECONDS WITH

npx sourcebook init

VIEW ON GITHUB star

FROM_THE_BLOG

RELATED_REPOS