Connect to a Database

Software Development with Claude Code

Dani Zysman

AI Curriculum Manager @ DataCamp

The Chinook Database

recraft: half: A stylized digital music store with vinyl records, musical notes, and database icons floating around

  • A digital music store with:
    • 275 artists (AC/DC, Aerosmith...)
    • 347 albums, 3,503 tracks
    • Customers, invoices, playlists

Real data to explore with Claude!

Software Development with Claude Code

The Project So Far

music-analytics-api/
  app.py
  routes.py
  test_routes.py
  models.py
  chinook.db         # <- SQLite database file
  CLAUDE.md
  .claude/           # Previous Agents, Skills and Hooks

SQLite: A self-contained database in a single file. No server setup needed.

Software Development with Claude Code

What Can We Query?

Chinook database tables and natural language queries

Software Development with Claude Code

Connect and Verify

$ claude mcp add-json sqlite '{"command": "uvx", "args": ["mcp-server-sqlite", 
"--db-path","~/chinook.db"1}'

Added stdio MCP server sqlite to local config
$ claude > /mcp
Software Development with Claude Code

Query with Natural Language

> Show me all Pink Floyd albums
Here are all the albums by Pink Floyd in the database:
Album ID: 183
Title: Dark Side Of The Moon
Artist: ID 120
There is 1 album by Pink Floyd in the database.
Software Development with Claude Code

The MCP Query Flow

layers: Ask Question, Claude Picks MCP Tool, MCP Server Runs SQL, Database Returns Data, Results Displayed

Software Development with Claude Code

Let's Practice!

Software Development with Claude Code

Preparing Video For Download...