GuideIntermediate
PostgreSQL & SQLAlchemy Guide
Learn PostgreSQL from installation to optimized queries, model your data with the SQLAlchemy ORM, manage your schema with Alembic, and integrate everything asynchronously with FastAPI. This guide replaces in-memory data with real, professional persistence, exactly as it is used in production. Built for developers who have already built APIs with FastAPI and need to take the next step: a well-designed relational database that scales.
- lessons
- 48
- modules
- 6
- available in
- English · Spanish
- certificate
- Yes
- access
- Free

What you'll be able to do
- Install and configure PostgreSQL locally and with Docker, master psql and pgAdmin
- Design schemas with advanced types (UUID, JSONB, TIMESTAMP) and constraints
- Write complex SQL queries with JOINs, subqueries, CTEs and aggregations
- Model 1:N and N:M relationships with foreign keys and junction tables
- Optimize performance with B-tree indexes and EXPLAIN ANALYZE
- Ensure data integrity with ACID transactions and isolation levels
- Model data in Python with SQLAlchemy 2.0 ORM (Mapped, mapped_column, relationships)
- Run CRUD with Sessions and queries with eager/lazy loading
- Version your schema with Alembic: autogenerate, upgrade/downgrade, data migrations
- Integrate PostgreSQL with FastAPI using AsyncSession, dependency injection and connection pooling
What you need to bring
It's for you if...
- Developers who already build APIs with FastAPI and need real persistence
- Backend developers from other languages (Node, Java, Go) who want to master the PostgreSQL + Python stack
- Programmers who have used basic SQL but never designed schemas with complex relationships or versioned migrations
- Anyone about to build the API of a blog or content platform who needs its complete schema
- Developers who want to learn SQLAlchemy 2.0 (the modern, typed API), not the legacy one
Requirements and materials
- Intermediate Python (classes, async/await, type hints, decorators)
- FastAPI for module 6: path operations, Pydantic, `Depends`, `APIRouter` and response models. The guide does not teach FastAPI; modules 1 to 5 don't need it
- Familiarity with the command line (terminal/shell)
- Docker installed (recommended to skip local install friction)
The syllabus, module by module
Open any of them to see its lessons.
- Introduction to Module 4: SQLAlchemy ORM
- Setup: Engine, Session, DeclarativeBase
- Basic models: Mapped and mapped_column
- Relationships: relationship() and back_populates
- CRUD with Session: add, commit, refresh, delete
- Queries with select(): filter, join, group_by
- Eager vs Lazy Loading: the N+1 problem
- Module Project: the blog in SQLAlchemy + Repository pattern
- Introduction to Module 5: Alembic Migrations
- Initializing Alembic in the project
- The initial migration: the "point zero"
- Autogenerate: the day-to-day flow
- Manual migrations: when autogenerate falls short
- Data migrations: migrating data alongside the schema
- Team workflow and CI/CD
- Module Project: the versioned blog with migrations
- Introduction to Module 6: FastAPI + Async SQLAlchemy
- Async SQLAlchemy: AsyncEngine and AsyncSession
- FastAPI + dependency injection
- CRUD endpoints with async repositories
- Connection pooling and performance
- Error handling and validation with Pydantic
- Async testing with pytest-asyncio
- Final Project: the complete blog API
Keep going with the full bootcamp.
At your own pace or 1:1, whichever you need.
What people usually ask
No limit. It's an open guide: come in whenever you like, as often as you like.
No. Modules run from easier to harder, but you can jump to the one you need. Progress is saved per lesson.
Whatever is needed is listed under “What you need to bring”, above. If nothing is listed there, you can start from zero.
In the forum and in the community WhatsApp group.
Yes. When you finish every lesson you get a statement of completion. Pass the guide's certification exam and it becomes a certificate, with a verifiable code you can share on LinkedIn.
No. This guide is one piece. The bootcamp puts the whole syllabus in order, with videos and projects, at your own pace.
Start whenever you like
What students say
These reviews are from enrolled students who completed at least 50% of the course. We moderate reviews only on content grounds (spam, offensive language, personal data), never for being critical or negative.
No approved reviews yet.
Be the first to share your experience!