Week 13 • Tuesday

Block 124: SQLAlchemy ORM Basics

Use SQLAlchemy ORM to interact with databases via Python objects.

Concepts

Code Examples

See exercise below.

Exercise

Define a Student model with SQLAlchemy. Create the table. Insert 3 records via ORM. Query all students with grade > 80 using ORM filter.

Homework

What are the advantages of using an ORM vs raw SQL? What are the disadvantages? Wednesday