CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/sqlite-python-best-practices

SQLite best practices for Python -- PRAGMAs per connection, context manager transactions, parameterized queries, row_factory, executemany, FK indexes

92

1.73x
Quality

90%

Does it follow best practices?

Impact

97%

1.73x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-2/

Event Registration System

Problem/Feature Description

A community center needs an event registration system built with Python and FastAPI. Use SQLite for storage (single server, moderate traffic from staff and members).

The system needs:

  • Events: title, description, location, event date and time, max capacity, registration deadline, status (upcoming/ongoing/completed/cancelled).
  • Registrations: links a member to an event, with registration timestamp and status (confirmed/waitlisted/cancelled). A member cannot register for the same event twice.
  • Register for an event: check that the event exists, registration deadline has not passed, and capacity is not exceeded. If at capacity, put on waitlist. The capacity check and registration insert must happen together to prevent overbooking under concurrent requests.
  • Cancel registration: mark as cancelled. If the event was at capacity and there are waitlisted members, automatically promote the earliest waitlisted member to confirmed.
  • List events with available spots count.
  • List registrations for a specific event, grouped by status.
  • Bulk create events: accept a list of events and create them all, or none if any validation fails.

Output Specification

Produce:

  • app/db.py -- Database connection and initialization
  • app/schemas.py -- Pydantic models
  • app/events.py -- Event-related route handlers
  • app/registrations.py -- Registration-related route handlers
  • app/main.py -- FastAPI application
  • requirements.txt -- With dependencies

Complete Python code, no placeholders or TODO comments.

evals

tile.json