Database Design & ORMs
Design real production database schemas, use SQLAlchemy ORM, manage migrations with Alembic, cache with Redis, and know when to reach for NoSQL.
Why learn Database Design & ORMs?
Knowing SQL is not the same as knowing how to design a database that survives contact with a real application. Database Design & ORMs teaches schema design with ER diagrams and normalization, then moves into the tools professional Python backends actually use: SQLAlchemy as an ORM, Alembic for safe migrations, Redis for caching, and enough NoSQL to know when a document database is the right call.
It is 6 modules, entirely hands-on: schema design and trade-offs, SQLAlchemy ORM for models and CRUD, Alembic migrations, Redis and caching to cut expensive query load, a NoSQL introduction built around MongoDB's document model, and a final module on polyglot persistence, designing systems that deliberately use more than one database.
This is a concept-driven course rather than one built around a single project, so every module is practiced with real, gradable exercises instead of a capstone.
Who this course is for
- Backend developers who can write SQL but have never designed a schema from scratch
- Python developers moving from raw SQL queries to an ORM
- Anyone who has run a migration that broke production and wants to never do that again
- Developers preparing for the FastAPI & REST APIs or Backend Capstone tracks
What you'll build and practice
- A normalized schema designed from requirements, with an ER diagram and real trade-offs
- SQLAlchemy models with relationships, queried without hand-written SQL
- Safe schema changes managed with Alembic migrations
- A Redis caching layer that measurably cuts response times
- A polyglot persistence design that puts each type of data in the right database
What you'll learn
Database Design & ORMs is organized into 6 focused modules. By the end you'll be comfortable with:
- Schema Design
- SQLAlchemy ORM
- Alembic Migrations
- Redis & Caching
- NoSQL Introduction
- Polyglot Persistence
Course curriculum
23 lessons across 6 modules. Lessons marked Free preview are readable without an account.
Module 1. Schema Design
Design production database schemas with ER diagrams, normalization, and real-world trade-offs.
- 10mER Diagrams and RelationshipsFree preview
Model your domain with Entity-Relationship diagrams before writing a single line of code.
- 12mNormalization vs DenormalizationFree preview
Understand database normalization (1NF–3NF) and when to intentionally denormalize for performance.
- 10mIndexing Strategies
Add the right indexes to make queries fast — and understand why over-indexing slows writes.
- 12mDesigning Real Schemas
Design complete, production-ready schemas for e-commerce and SaaS applications.
Module 2. SQLAlchemy ORM
Use SQLAlchemy to define models, perform CRUD, and query relationships without writing raw SQL.
- 10mDefining SQLAlchemy Models
Map Python classes to database tables with SQLAlchemy's declarative model system.
- 12mAdvanced SQLAlchemy Queries
Write complex queries with filters, joins, aggregations, and subqueries using SQLAlchemy's ORM.
- 10mRelationships and Loading Strategies
Configure SQLAlchemy relationships and choose between lazy, eager, and explicit loading.
- 8mRaw SQL When ORM Falls Short
Use SQLAlchemy's text() for complex queries that are impractical with the ORM.
- 8mORM Performance Patterns
Avoid common SQLAlchemy performance traps and write efficient database code.
Module 3. Alembic Migrations
Manage database schema changes safely with Alembic — the standard migration tool for SQLAlchemy projects.
- 8mWhy Migrations Matter
Understand why direct schema changes in production are dangerous and how migrations provide safety.
- 12mCreating and Running Migrations
Generate, review, and apply Alembic migrations — the daily workflow for schema changes.
- 10mZero-Downtime Migrations
Apply schema changes to a running production database without any downtime or data loss.
- 8mMigrations in Production
Integrate Alembic migrations into your CI/CD pipeline for automated, reliable deployments.
Module 4. Redis & Caching
Cache expensive database queries and API responses with Redis to dramatically reduce response times.
- 8mWhat is Redis?
Understand Redis as an in-memory data store — when and why to use it alongside PostgreSQL.
- 12mCaching API Responses
Implement a cache-aside pattern to cache expensive API endpoint responses in Redis.
- 10mRate Limiting with Redis
Implement scalable, accurate rate limiting using Redis atomic operations across multiple server instances.
- 10mRedis Data Structures
Use Redis hashes, lists, sets, and sorted sets for use cases beyond simple key-value caching.
Module 5. NoSQL Introduction
Understand when NoSQL databases (MongoDB) are the right choice and how the document model works.
- 10mSQL vs NoSQL Trade-offs
Understand when relational databases and NoSQL databases each shine — and when to use both.
- 12mMongoDB Document Model
Work with MongoDB documents, collections, and CRUD operations using pymongo.
- 8mWhen to Choose NoSQL
Apply a decision framework to choose the right database for your specific use case.
Module 6. Polyglot Persistence
Design systems that use multiple databases for different concerns — and know where each data type lives.
- 10mPolyglot Persistence Patterns
Design a multi-database backend architecture where each database handles what it does best.
- 8mDatabase Connection Management
Configure connection pools for PostgreSQL and Redis to handle production load efficiently.
- 8mDatabase Design Review Checklist
Review your database design against a production checklist before shipping.
Frequently asked questions
- Do I need to already know SQL before starting this course?
- Yes, basic SQL comfort from a track like SQL & Databases is assumed. This course is about designing and interacting with databases at the application layer through an ORM, not about learning SQL syntax itself.
- Is this course only about SQLAlchemy, or does it cover database design too?
- Both. Module 1 is dedicated schema design with ER diagrams and normalization before any ORM code appears. Modules 2 through 6 then cover SQLAlchemy, Alembic, Redis, NoSQL, and combining multiple databases deliberately.
- Does the course include a capstone project?
- No. This is a concept-driven track, six modules each with their own real practice exercises, rather than one project built up over the whole course. The Backend Capstone track is where these skills get applied to a single deployed API.
- When would I actually reach for MongoDB instead of PostgreSQL?
- Module 5 covers exactly that judgment: when the document model fits your data better than rows and columns, and Module 6 goes further, teaching you to design systems that use both a relational database and a document or cache store for different concerns.
- How does this course relate to the SQL & Databases track?
- SQL & Databases teaches you to write and reason about SQL queries directly. This course sits one layer up: designing schemas properly and working with a database through an ORM and migration tool the way a Python backend team actually does day to day.
Ready to start Database Design & ORMs?
Create a free account to track progress, earn XP, and get instant help from the AI tutor as you code.
Create your free account