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

@mazhu/dbq

v1.0.0

Published

A multi-database query CLI tool — like pgcli/mycli but supports PostgreSQL, MySQL, SQLite & MongoDB

Downloads

68

Readme

dbq 🗄️

A multi-database query CLI tool — like pgcli/mycli but supports PostgreSQL, MySQL, SQLite & MongoDB

npm version License: MIT

Features

  • 🔌 Multi-database support — PostgreSQL, MySQL, SQLite, MongoDB
  • 🎨 Colorful table output — Easy to read query results
  • 📤 Export to CSV/JSON — Save query results in your preferred format
  • 🔍 Schema inspection — List tables, view column details
  • Connection management — Save and switch between database connections
  • 🚀 Zero-config — Just connect and query

Install

npm install -g @mazhu/dbq

Quick Start

# Connect to a database
dbq connect postgres://user:pass@localhost:5432/mydb
dbq connect mysql://user:pass@localhost:3306/mydb
dbq connect sqlite:///path/to/database.db
dbq connect mongodb://localhost:27017/mydb

# Run a query
dbq query "SELECT * FROM users LIMIT 10"

# List all tables
dbq tables

# View table schema
dbq schema users

# Export query results
dbq export "SELECT * FROM users" --format csv --output users.csv
dbq export "SELECT * FROM users" --format json --output users.json

Commands

dbq connect <url>

Connect to a database. The URL format depends on the database type:

| Database | URL Format | |-----------|-----------------------------------------------| | PostgreSQL| postgres://user:pass@host:port/dbname | | MySQL | mysql://user:pass@host:port/dbname | | SQLite | sqlite:///path/to/database.db | | MongoDB | mongodb://host:port/dbname |

Options:

  • --name, -n — Save connection with a name for quick switching
  • --save — Save connection to config for later use

dbq query <sql>

Execute a SQL query and display results in a formatted table.

Options:

  • --limit, -l — Limit number of rows (default: 100)
  • --no-header — Don't show column headers

dbq tables

List all tables in the connected database.

dbq schema <table>

Show the structure of a specific table including columns, types, and constraints.

dbq export <sql> --format <csv|json>

Export query results to a file.

Options:

  • --format, -f — Output format: csv or json (required)
  • --output, -o — Output file path (defaults to stdout)

dbq connections

List saved connections.

dbq use <name>

Switch to a saved connection.

Configuration

Connections are saved in ~/.dbq/config.json. You can edit this file directly or use the CLI commands.

MongoDB Support

MongoDB uses a different query syntax. For MongoDB:

# Query with MongoDB syntax
dbq query '{"collection": "users", "filter": {"age": {"$gt": 18}}, "limit": 10}'

# List collections (equivalent to tables)
dbq tables

# View collection schema (sampled)
dbq schema users

License

MIT © mazhu