Python Bytes

#471 The ORM pattern of 2026?

Mar 2, 2026
A lively dive into preferring raw SQL with dataclasses for AI-friendly, typed data access and performance gains. A maintenance update on pytest-check and added mypy support. A look at dataclass-wizard for fast, typed parsing across formats. A spotlight on SQLiteo, a macOS SQLite browser, and a chat about agents, trust, and how AI shifts development workflows.
Ask episode
AI Snips
Chapters
Transcript
Episode notes
INSIGHT

Raw Queries Are Better For AI Coding

  • Michael Kennedy argues AI coding is far better trained on raw database queries than on specific ORMs, making raw queries more robust for agentic development.
  • He measured PyMongo-style libraries having tens to hundreds of times more training footprint than individual ORMs, so AI will prefer native query patterns.
ADVICE

Return Dataclasses From Raw Data Access

  • Do implement a small data access layer that uses raw queries internally but returns typed dataclass objects to callers for IDE support and type safety.
  • Michael recommends dataclasses (or optionally Pydantic externally) to avoid heavy runtime validation in every database read.
INSIGHT

Dataclasses Trade Validation For Performance

  • Dataclasses give type hints, low overhead, and no extra dependencies, making them a lightweight alternative to ORMs or Pydantic in the data access layer.
  • Michael notes Pydantic adds runtime validation cost and may be unnecessary for reads since bad data is already stored.
Get the Snipd Podcast app to discover more snips from this episode
Get the app