Typorithm learning path
SQLAlchemy and Alembic: reliable database work
Own database units of work through SQLAlchemy 2.1 typed models, current autoflush, scalar and row results, deterministic pages, foreign keys, measured loading, aggregates, synchronized DML, savepoints, version conflicts and async Sessions. Review real Alembic revisions, autogenerate candidates, SQLite batch changes, bounded backfills and backup restoration. 18 topics with six substantial sections, gradual tasks, two hints and prepared results. On a computer type and recall focused code; in the app read examples and answer explained questions. Complete programs execute in the downloadable owned SQLite lab, verified with Python 3.13, SQLAlchemy 2.1.8, Alembic 1.20.1 and aiosqlite 0.22.1. No live service or production database is used.

Study with a practical destination
Use the linked lessons in order, complete the lab and explain the decisions without the reference. Select the path and depth that match your role.
Your learning path
0 of 18 lessons completed
Saved on this device
Module 1 · 1 lessons
Engine, connections and bound SQL parameters
Own a small database transaction and keep SQL structure separate from input values.
Module 2 · 1 lessons
Typed declarative models and database constraints
Distinguish a mapped Python attribute, column nullability and a constraint enforced by the database.
Module 3 · 1 lessons
Session state, autoflush and durability in 2.1
Observe an inserted row inside a transaction without confusing flush with a durable commit.
Module 4 · 1 lessons
Rows, scalar columns and ORM result shapes
Choose the result API from the selected expressions rather than assuming every query returns model objects.
Module 5 · 1 lessons
Filtered and deterministic bounded pages
Combine a precise population predicate with a total order and a validated result limit.
Module 6 · 1 lessons
Foreign keys, relationships and parent ownership
Verify relational integrity at the database boundary instead of mistaking an ORM link for an enforced constraint.
Module 7 · 1 lessons
Loading relationships without an N+1 surprise
Preserve the parent population while measuring lazy, select-in and joined collection loading.
Module 8 · 1 lessons
Outer joins and honest aggregate populations
Count real child identities while retaining parents that have no matching child rows.
Module 9 · 1 lessons
Set-based updates and the identity map
Keep loaded ORM objects consistent with an explicit bulk statement and verify the database separately.
Module 10 · 1 lessons
Savepoints and recovery from a failed flush
Reject a duplicate insert while keeping valid work in the surrounding transaction.
Module 11 · 1 lessons
Optimistic version checks and deliberate retries
Reject an update based on an old mapped version and reread current state before applying a reviewed merge policy.
Module 12 · 1 lessons
Async Session ownership and implicit IO
Give independent tasks their own Sessions and avoid unawaited reloads of expired ORM attributes.
Module 13 · 1 lessons
Schema bootstrap is not a migration history
Observe what create_all leaves unchanged and apply one explicit additive operation to an existing table.
Module 14 · 1 lessons
Revision chains, upgrade, downgrade and stamp
Run an actual two-revision Alembic environment and compare schema execution with merely marking a version.
Module 15 · 1 lessons
Autogenerate candidates require a review
Compare proposed metadata with the real schema, apply a reviewed change and check for a remaining diff.
Module 16 · 1 lessons
SQLite batch changes that preserve rows and constraints
Backfill existing values before tightening nullability and verify the recreated table’s constraints and indexes.
Module 17 · 1 lessons
Expand, bounded backfill and contract tightening
Walk stable IDs in small batches before making a newly populated column non-nullable.
Module 18 · 1 lessons
Capstone: migrate, inspect and restore an owned database
Verify both revision history and data after a real SQLite backup and restoration.