Edocti Training
Flask & SQLAlchemy — Micro Training (4h)
Geplante Sessions
Aktuell sind keine Termine verfügbar.
Fähigkeiten, die Sie lernen werden
Flask-Grundlagen
API-Routing
SQLAlchemy ORM
Datenbank-Migrationen
RESTful Endpoints
Transaktionsmanagement
Automatisiertes Testing
Backend Deployment
Curriculum
Teil 1 — Projektsetup & Architektur
- App Factory Pattern, Blueprints und Configuration (dev/test/prod)
- Database URL, Engine, Session; Einsatz von Flask‑SQLAlchemy vs. plain SQLAlchemy
- Request Lifecycle und Session‑per‑Request; Teardown und Error Handler
- Alembic init und erste Migration; Seed‑Daten
Teil 2 — Modellierung & Queries mit SQLAlchemy ORM
- Models, Columns und Constraints; Timestamps und UUIDs
- One‑to‑Many / Many‑to‑Many; Backrefs, Cascades
- Query‑Muster: Filtering, Joins, selectinload vs. joinedload; Pagination
- Validierung an der Grenze (Marshmallow oder Pydantic)
Teil 3 — REST Endpoints & Transaktionen
- Create/Read/Update/Delete Endpoints; Idempotency und Upserts (kurz)
- Transaktions‑ und Isolations‑Basics; Commit/Rollback; 404/409/422 Antworten
- Error Handling und problem+json; DB‑Exceptions nach HTTP mappen
- Auth Placeholder: JWT‑Skelett (optional)
Teil 4 — Tests, Performance & Deployment
- pytest Fixtures; temporäre DB (SQLite) vs. Postgres in Docker
- Factory‑basierte Tests; transaktionale Tests und Rollbacks
- N+1 vermeiden; Indexe und EXPLAIN (Intro); Connection‑Pool‑Sizing
- Packaging und Betrieb mit Gunicorn; `.env` und 12‑Factor‑Hinweise
Optionale Module
Optional — Docker Compose Quickstart
- Compose‑Datei mit Postgres und App; Runtime‑Umgebungsvariablen
- Healthchecks, Migrationen beim Start und Seed‑Daten
Kursablauf
- Teil 1: 09:00–10:00
- Pause: 10:00–10:10
- Teil 2: 10:10–11:10
- Pause: 11:10–11:20
- Teil 3: 11:20–12:20
- Pause: 12:20–12:30
- Teil 4: 12:30–13:30