SQLite-backed CLI to track books, loans, fines, and student memberships.
Tick off requirements as you build to track real-time completion.
Follow this chronological guide to build the project from scratch.
Establish local database connection with PRAGMA foreign keys and create books, members, and loans tables.
import sqlite3
def init_database():
with sqlite3.connect("library.db") as conn:
cursor = conn.cursor()
# Enable Foreign Key support explicitly
cursor.execute("PRAGMA foreign_keys = ON;")
cursor.execute("""
CREATE TABLE IF NOT EXISTS books (
isbn TEXT PRIMARY KEY,
title TEXT NOT NULL,
author TEXT NOT NULL,
available INTEGER DEFAULT 1
)
""")
cursor.execute("""
CREATE TABLE IF NOT EXISTS members (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
email TEXT UNIQUE NOT NULL
)
""")
cursor.execute("""
CREATE TABLE IF NOT EXISTS loans (
id INTEGER PRIMARY KEY AUTOINCREMENT,
book_isbn TEXT NOT NULL,
member_id INTEGER NOT NULL,
borrow_date TEXT NOT NULL,
due_date TEXT NOT NULL,
returned INTEGER DEFAULT 0,
FOREIGN KEY(book_isbn) REFERENCES books(isbn),
FOREIGN KEY(member_id) REFERENCES members(id)
)
""")
conn.commit()Real issues students hit during development and how to troubleshoot them fast.
Continue building your skills with similar projects.
Sleek weather dashboard using OpenWeather API with geolocation, 5-day forecast, and dynamic weather themes.
Personal budget tracker with transaction log, category breakdown, and Chart.js pie charts.
Movie discovery app with TMDB API, trending lists, search, and detail modals.