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 user management service using SQLAlchemy and PostgreSQL. The service manages users and their orders.
Produce Python files in a src/ directory:
src/database.py -- engine configuration, session factory, Base class, and session dependency functionsrc/models.py -- User and Order ORM models with their relationshipsrc/crud.py -- functions for:
create_user(db, name, email) -- create a new usercreate_order(db, user_id, items) where items is a list of dicts with product_name, quantity, unit_price_cents -- create an order computing total_centsget_user_with_orders(db, user_id) -- return a user with all their orders loadedNo test files, no migration files, no API framework code. Just the pure database layer.