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-4/

Personal Finance Tracker

Problem/Feature Description

Build a personal finance tracking API with Python and Flask. Use SQLite for storage (this is a single-user desktop app).

The system needs:

  • Accounts: name, type (checking/savings/credit/cash), current balance in dollars, currency (default USD).
  • Transactions: each transaction belongs to one account and has an amount in dollars, type (income/expense/transfer), category (groceries, rent, salary, etc.), description, and date.
  • Transfers: moving money between two accounts. The source account balance decreases and the destination account balance increases by the same amount. Both balance updates and the transaction records must be saved together -- if any part fails, nothing should change.
  • Monthly summary: total income, total expenses, and net change grouped by category for a given month.
  • Record a transaction: create a transaction record and update the account balance atomically.
  • Import transactions from CSV: accept a CSV file with date, amount, category, description columns and import all rows for a given account. If any row is malformed, reject the entire import.

Output Specification

Produce:

  • app/database.py -- Database connection and schema
  • app/models.py -- Pydantic models for request/response
  • app/routes.py -- Flask route handlers
  • app/app.py -- Flask application setup
  • requirements.txt -- With dependencies

Complete Python code, no placeholders or TODO comments.

evals

tile.json