Edocti Training
Flask & SQLAlchemy — Micro Training (4h)
Scheduled sessions
No sessions are available at the moment.
Skills You Will Learn
Flask Foundations
API Routing
SQLAlchemy ORM
Database Migrations
RESTful Endpoints
Transaction Management
Automated Testing
Deployment Tips
Curriculum
Part 1 — Project setup & architecture
- App factory pattern, Blueprints and configuration (dev/test/prod)
- Database URL, engine, Session; using Flask‑SQLAlchemy vs. plain SQLAlchemy
- Request lifecycle and session‑per‑request pattern; teardown and error handlers
- Alembic init and first migration; seeding data
Part 2 — Modeling & querying with SQLAlchemy ORM
- Models, columns and constraints; timestamps and UUIDs
- One‑to‑many / many‑to‑many relationships; backrefs, cascades
- Query patterns: filtering, joins, selectinload vs joinedload; pagination
- Validation at the boundary (Marshmallow or Pydantic)
Part 3 — REST endpoints & transactions
- Create/read/update/delete endpoints; idempotency and upserts (brief)
- Transactions and isolation basics; commit/rollback; 404/409/422 responses
- Error handling and problem+json; mapping DB exceptions to HTTP
- Auth placeholder: JWT skeleton (optional)
Part 4 — Tests, performance & deployment tips
- pytest fixtures; temporary DB (SQLite) vs. Postgres in Docker
- Factory‑driven app tests; transactional tests and rollbacks
- Avoid N+1; indexes and EXPLAIN (intro); connection pool sizing basics
- Packaging and running with Gunicorn; `.env` and 12‑factor notes
Optional modules
Optional — Docker Compose quickstart
- Compose file with Postgres and the app; runtime env vars
- Healthchecks, migrations on startup, and seed data
Course Day Structure
- Part 1: 09:00–10:00
- Break: 10:00–10:10
- Part 2: 10:10–11:10
- Break: 11:10–11:20
- Part 3: 11:20–12:20
- Break: 12:20–12:30
- Part 4: 12:30–13:30