Add durable persistence to your Python programs using relational databases. You will master SQLite with the built-in sqlite3 module, write injection-safe parameterised queries, perform CRUD and transactions, connect to PostgreSQL, and model data with the SQLAlchemy ORM. This course supports preparation for the Python Institute PCPP certification.
Watch the free preview
The relational model and why databases beat files — free to watch, no account needed.
What you'll learn
- Explain the relational model and connect to a SQLite database with the sqlite3 module
- Write parameterised queries that are safe from SQL injection
- Perform full CRUD operations and manage transactions with commit and rollback
- Query related tables using JOINs, aggregation and GROUP BY
- Connect to PostgreSQL and model data with the SQLAlchemy ORM
Syllabus
Relational Databases & SQLite Foundations
The relational model and why databases beat filesFree preview
Talking to SQLite with the sqlite3 module
Safe Queries & CRUD
Parameterised queries and SQL-injection safety
Full CRUD — Create, Read, Update, Delete
Transactions & Relationships
Transactions, commit and rollback
Relationships — JOINs, foreign keys and aggregates
PostgreSQL & the SQLAlchemy ORM
Scaling up to PostgreSQL
The SQLAlchemy ORM and migrations
Lab — 10 Programming Exercises & Solutions
Programming Exercises 1–5
Programming Exercises 6–10