npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sdjz/usql

v0.1.2

Published

Query any database from your terminal. SQLite, Postgres, MySQL, DuckDB, Parquet.

Readme

usql

Query any database from terminal. Feed your database to LLMs.

usql

npm i -g @sdjz/usql

AI Integration

Generate a token-optimized schema dump for ChatGPT, Claude, or any LLM:

usql inspect ./myapp.db
{"v":1,"d":"sqlite","t":{"users":{"c":{"id":"s","name":"s","email":"s"},"pk":["id"],"fk":[],"s":[{"id":"1","name":"Alice"}]}}}

Paste this into your AI chat. It now understands your schema, relationships, and sample data.

usql inspect postgres://localhost/prod --pretty   # Human-readable
usql inspect ./app.db --rows 5                    # More sample rows

Quick Start

# Query any database
usql ./data.db "SELECT * FROM users"
usql postgres://user:pass@host/db "SELECT now()"
usql mysql://user:pass@host/db "SHOW TABLES"

# Use -c for complex SQL (avoids shell quote issues)
usql ./data.db -c "SELECT * FROM logs WHERE msg LIKE '%error%'"

# Output formats
usql ./data.db "SELECT * FROM users" --format=csv
usql ./data.db "SELECT * FROM users" --format=json
usql ./data.db "SELECT * FROM users" --full  # No truncation

Drivers auto-install on first use. Zero config.

Supported Databases

| Database | Connection | |----------|------------| | SQLite | ./file.db | | PostgreSQL | postgres://user:pass@host/db | | MySQL | mysql://user:pass@host/db | | DuckDB | duckdb:./file.duckdb | | Parquet | ./file.parquet | | MySQL Dump | ./dump.sql (auto-cached) |

Interactive REPL

usql ./app.db
sqlite> .tables
users orders

sqlite> .schema users
column_name  data_type
----------- ----------
id           INTEGER
name         TEXT
email        TEXT

sqlite> .sample users
id  name   email
--- ------ -----------------
1   Alice  [email protected]
2   Bob    [email protected]

sqlite> .inspect
{"v":1,"d":"sqlite",...}   # Paste to AI!

REPL Commands

| Command | Description | |---------|-------------| | .tables | List all tables | | .schema <t> | Show table structure | | .sample <t> | Preview first 5 rows | | .count <t> | Count rows | | .indexes <t> | Show indexes | | .inspect | AI schema dump | | .full | Toggle full display | | .time | Toggle query timing | | .export csv\|json | Export last result |

CLI Options

-c, --command <sql>    Execute SQL and exit
--format <fmt>         Output: table (default), csv, json
--full, --no-truncate  Show full content
-q, --quiet            Minimal output
--json                 JSON output (auto when piped)

Pipe to Anything

Output is JSON when piped:

usql ./app.db "SELECT * FROM users" | jq '.rows | length'
usql ./app.db "SELECT * FROM users" --format=csv > export.csv

MIT