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 an async notification service using SQLAlchemy and FastAPI. The service manages user notifications.
Produce Python files in a src/ directory:
src/database.py -- async engine configuration, async session factory, Base class, and async session dependency for FastAPIsrc/models.py -- User and Notification ORM models with their relationshipsrc/main.py -- FastAPI app with these endpoints:
POST /notifications -- accepts JSON with user_id and message, creates a notificationGET /users/{user_id}/notifications -- returns all unread notifications for the userPATCH /notifications/{notification_id}/read -- marks a notification as readNo test files, no migration files.