CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/sqlalchemy-best-practices

SQLAlchemy patterns — engine setup, session management, declarative models,

98

1.96x
Quality

99%

Does it follow best practices?

Impact

98%

1.96x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-2/

Blog Platform Database Layer

Build the database layer for a blog platform using SQLAlchemy and PostgreSQL.

Domain

  • Author: name, email (unique), bio (optional text), created_at
  • Post: title, body (text), status (draft/published/archived, default draft), published_at (nullable), created_at, updated_at, belongs to an author
  • Comment: body, commenter_name, created_at, belongs to a post

Requirements

Produce Python files in a src/ directory:

  • src/database.py -- engine configuration, session factory, Base class, and session dependency
  • src/models.py -- Author, Post, and Comment ORM models with relationships
  • src/crud.py -- functions for:
    • create_post(db, author_id, title, body) -- create a draft post for an author
    • publish_post(db, post_id) -- set status to "published" and set published_at to now
    • get_published_posts(db) -- return all published posts with their authors loaded, ordered by published_at descending

No test files, no migration files, no API framework code.

evals

tile.json