sqlalchemy-postgres

Build async SQLAlchemy 2.0 data layers with PostgreSQL, Pydantic, and Alembic migrations.

Updated Feb 4, 2026
One-click install
npx skills add https://github.com/ytqh/agent-skills --skill sqlalchemy-postgres
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sqlalchemy-postgres
Source: https://github.com/ytqh/agent-skills/tree/main/skills/sqlalchemy-postgres
Command: npx skills add https://github.com/ytqh/agent-skills --skill sqlalchemy-postgres

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides structured guidance for building production-ready database layers with SQLAlchemy 2.0, Pydantic, Alembic, and PostgreSQL, simplifying model design, migrations, and async data access.

Core Features & Use Cases

  • Setup a full database layer with async SQLAlchemy 2.0, PostgreSQL, and Alembic migrations.
  • Define models and Pydantic schemas with clear separation and type safety.
  • Implement the repository pattern and async CRUD operations for scalable data access.

Quick Start

Install and configure PostgreSQL, initialize Alembic, scaffold models and repositories, and wire the FastAPI dependency for async sessions.

Frequently Asked Questions about sqlalchemy-postgres

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up an async SQLAlchemy PostgreSQL data layer in FastAPI?

You can build an async SQLAlchemy PostgreSQL data layer in FastAPI by configuring an async engine, defining typed models with Mapped[], and wiring FastAPI dependencies for asynchronous database sessions.

Does SQLAlchemy 2.0 work with Pydantic for database model validation?

SQLAlchemy 2.0 works with Pydantic by maintaining a clear separation between database models and Pydantic schemas, ensuring type safety and structured data validation throughout your async data access layer.

What is the repository pattern in SQLAlchemy for async CRUD operations?

The repository pattern in SQLAlchemy encapsulates async CRUD operations within dedicated repository classes, abstracting data access logic from your FastAPI routes to ensure scalable and maintainable database interactions.

How do I manage Alembic migrations for an async SQLAlchemy PostgreSQL setup?

You manage Alembic migrations for an async SQLAlchemy PostgreSQL setup by initializing Alembic to generate versioned migrations, ensuring your database schema changes are tracked and applied systematically.

Can I use typed SQLAlchemy models instead of raw queries for PostgreSQL data access?

You can use typed SQLAlchemy models with Mapped[] for PostgreSQL data access instead of raw queries, providing static type checking and clear column definitions while supporting async repository implementations.