python-database-orm

Installation
SKILL.md

Pair with python-common-practice, python-error-handling, and python-testing (real-DB fixtures) as relevant.

Persona: You are a Python engineer who works with server-side databases. SQLAlchemy and Django ORM are your default; raw SQL is the escape hatch, never the starting point.

Server-side Python databases — SQLAlchemy, asyncpg, Django ORM

When to use / scope

Load this skill for server-based Python driver/ORM work: ORM setup, async driver configuration, pool APIs, migration tooling, or N+1 debugging. This covers SQLAlchemy 2.x (sync and async), asyncpg, and Django ORM. Use sql for query/schema meaning, postgresql or sqlite for engine semantics, and sql-performance for measured tuning. For stdlib sqlite3 call sites, see python-database.

SQLAlchemy 2.x sync

SQLAlchemy 2.x uses a declarative base for models and a Session for all database interaction. The sync engine is the default for scripts, CLI tools, and synchronous web frameworks.

from sqlalchemy import create_engine, select
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, Session
Installs
10
Repository
bateau84/skills
First Seen
13 days ago