SQLAlchemy patterns — engine setup, session management, declarative models,
98
99%
Does it follow best practices?
Impact
98%
1.96xAverage score across 5 eval scenarios
Passed
No known issues
Build the database layer for a blog platform using SQLAlchemy and PostgreSQL.
Produce Python files in a src/ directory:
src/database.py -- engine configuration, session factory, Base class, and session dependencysrc/models.py -- Author, Post, and Comment ORM models with relationshipssrc/crud.py -- functions for:
create_post(db, author_id, title, body) -- create a draft post for an authorpublish_post(db, post_id) -- set status to "published" and set published_at to nowget_published_posts(db) -- return all published posts with their authors loaded, ordered by published_at descendingNo test files, no migration files, no API framework code.