🔥 BLACK FRIDAY SALE1 course ₹199·any 3 courses ₹399 for 3 months·ALL courses + 1 mock interview ₹599 for 6 monthsClaim offer →

Python · Building Real Applications · Intermediate · 32 min read

Python Databases with SQLAlchemy 2.0: Engines, Sessions, ORM Models, Queries, Transactions and Alembic Migrations

Work with relational databases from Python using SQLAlchemy 2.0. Covers Core versus ORM, engines and connection pools, declarative models with Mapped and mapped_column, relationships and loading strategies, the select-based query API, sessions and the unit of work, transactions and isolation, avoiding N+1 queries, bulk operations, migrations with Alembic, testing with transactions, async usage and common production problems.

Python Databases with SQLAlchemy 2.0: Engines, Sessions, ORM Models, Queries, Transactions and Alembic Migrations: lesson illustration

A first look

  • Intermediate level · 32 min read
  • 7 interview questions with model answers
  • Building Real Applications · Python Mastery

You will learn to

  • Core versus ORM, and the engine, connection and session objects
  • Declarative models in the 2.0 style (Mapped, mappedcolumn), relationships
  • Querying with select(); filters, joins, aggregates, pagination
  • …and 3 more topics inside
Create an account to start

Create a free account to see what this lesson covers

  • Every free lesson in every section, in full
  • Track your progress and pick up where you left off
  • Free practice questions and an incident simulation
  • Takes under a minute: name, email and a password

No card needed. Full access to Python is a paid upgrade you can choose later.