Skip to content

Fix Week 2 SQLite demo database path and add 'which is my database?' comment - #3

Open
enaguero wants to merge 1 commit into
warestack:mainfrom
enaguero:fix/week2-sqlite-database-path
Open

enaguero wants to merge 1 commit into
warestack:mainfrom
enaguero:fix/week2-sqlite-database-path

Conversation

@enaguero

Copy link
Copy Markdown

Summary

  • The Week 2 demo API in class-2/week2-sqlite/main.py connected to database.db, but Part 1 of the lab creates university.db. SQLite silently created an empty database.db, so /students failed with no such table: students.
  • Point the demo at university.db, matching the lab handout (part-1.md and part-2.md).
  • Add a student-facing comment above the path: check where you are connecting and ask "which one is my database?", plus a note that sqlite3.connect() creates an empty file when the path is wrong, so the symptom is "no such table" rather than "file not found".
  • Add university.db to .gitignore (same convention as app.db / auth.db), since Part 1 has students generate and reset it from setup_students.sql.

This is also the first commit of the week2-sqlite demo project (main.py, requirements.txt, setup_students.sql).

Test plan

  • In class-2/week2-sqlite, create the database if it does not exist yet: sqlite3 -bail university.db ".read setup_students.sql"
  • Activate .venv, run uvicorn main:app --reload, open http://127.0.0.1:8000/students
  • Expect a JSON list of the three students (Ada Lovelace, Alan Turing, Grace Hopper)

🤖 Generated with Claude Code

…-path trap

The demo API pointed at database.db while Part 1 of the lab creates
university.db. sqlite3.connect() silently created an empty database.db,
so every request to /students failed with "no such table: students".

Point the demo at university.db to match the lab handout, add a
student-facing comment above the path ("check where you are connecting,
which one is my database?"), and ignore the generated university.db.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant