TUTORIAL: SQLAlchemy 2.0
summary
Covers how SQLAlchemy 2.0 actually connects, models and persists: create an engine with create_engine('sqlite:///:memory:'), use base.metadata.create_all under engine.begin to emit DDL, declare ORM models with the new mapped_as_dataclass + mapped_column annotations (server defaults via func.now), run inserts/selects with parameterized statements or session.execute/session.scalars, and persist objects via session.add → flush/identity‑map → session.commit, showing the same Python instance returned after flush.
AI-written summary · about
chapters (10)
- 0:00Introduction to SQLAlchemy
- 4:44Working with the engine
- 13:23Connection management
- 20:33Table metadata modeling
- 33:53Creating database schema
- 40:07Inserting data
- 47:05Bulk data insertion
- 54:21Selecting data
- 1:10:01Filtering and ordering
- 1:22:28ORM session and work unit
related talks
01h 28mSQLAlchemy and You - Making SQL the Best Thing Since Sliced Bread
28mThe Ultimate Python Database Toolkit: SQLAlchemy
30mThe magic of SQLAlchemy
32mNo More Raw SQL: SQLAlchemy & ORMs
34mLet's talk Databases in Python: SQLAlchemy and Alembic
29mDatabase Sorcery 101 Ditch the Ancient SQL Scrolls for SQLModel
37mNo More Raw SQL with SQLAlchemy and ORMs
01h 58mNo More Raw SQL: SQLAlchemy, ORMs & asyncio
