SQLAlchemy 2.0 Tutorial: Core & ORM Reimagined

Added:

Core Intro
2.0 Changes
Engine Use
Transactions
Table Metadata
Core Selects
Advanced SQL
ORM Basics
ORM CRUD
Relationships

Core Intro

0:04
Playing Section
  • 1

    Introduces SQLAlchemy 2.0's transitional 1.4 release and its core philosophies.

  • 2

    Highlights the necessity of SQL knowledge for using the toolkit effectively.

  • 3

    Outlines the session's structure: first core, then ORM, from an engine-centric view.

Proficiency in Python programming, specifically Object-Oriented Programming (OOP) concepts like classes, attributes, and inheritance.
Fundamental knowledge of Relational Database Management Systems (RDBMS) and standard SQL syntax, including queries, joins, and constraints.
Basic understanding of database transaction concepts such as commits, rollbacks, and ACID properties.
Conceptual familiarity with what an Object-Relational Mapper (ORM) is and why it is used in application development.
Database schema migration management using Alembic, the official migration tool designed for SQLAlchemy.
Advanced SQLAlchemy ORM design patterns, including eager/lazy loading strategies, hybrid attributes, and association proxies.
Asynchronous database programming utilizing SQLAlchemy 2.0's asyncio extension and async drivers.
Integrating SQLAlchemy 2.0 with web frameworks like FastAPI or Flask for building scalable REST APIs.
Query profiling, performance tuning, and implementing efficient indexing and caching strategies with SQLAlchemy.
45.1K views543likes2:44:38@sixfeetupcorpOriginal Release: 2021-06-18

SQLAlchemy 2.0 introduces a redesigned Core architecture that provides a consistent Python interface for relational databases, featuring a new SQL Expression Language that builds upon table metadata to compose SQL statements programmatically using method chaining, with explicit transaction management through begin() and commit() patterns, and unified result handling across Core and ORM layers. The tutorial demonstrates how to create engines, manage connections with context managers, execute text queries with bound parameters, build complex SELECT statements with joins and subqueries, and handle transactions including save points and isolation levels, all while maintaining database agnosticism through SQLAlchemy's facade over the Python DB API.