Oct 15: Querying with SQLModel
Learning Objectives
After today's class, you should be able to:
- Write
select()queries that return objects instead of rows. - Explain the difference between objects attached to and detached from a session.
Lesson Outline
HW4 [10 min]
- HW4 – Vet Clinic in SQLModel: classes, a view, and Faker data
- Show
hw4.dbmlin dbdiagram.io; some constraints are only in the notes - Step 5 needs today's lab: attached vs. detached objects
- Show
SQLModel [20 min]
Lab [45 min]
- Querying with SQLModel
- Query the core schema with
select(), joins, and relationships - Steps 1–5 in class; Step 6 if you have time
- Query the core schema with