Learn Flask: Databases
Give a Flask app a memory. Connect Flask-SQLAlchemy to a database, describe tables as Python models, link them with relationships, then create, query, update and delete rows through the session. Every example is run and checked against Flask-SQLAlchemy 3.1 and SQLAlchemy 2.
- Intermediate level
- 3 modules
- 5 lessons
- 35 quiz questions
Syllabus
01Models and RowsConnect a Flask app to a SQLite database, describe tables as Python classes, link two tables with a foreign key and a relationship, and save the first rows.2 lessons
02QueryingRead rows back with select, narrow and order them, fetch one row safely, follow relationships without a flood of queries, and turn a missing row into a 404 in a route.1 lesson
03Changing DataUpdate and delete rows, keep related rows consistent with cascades, recover cleanly when a commit fails, then build a small observatory API that uses every piece.2 lessons