Registry / database / askdb
library1.0.0-beta.20jsnpmunverified

AskDB is a CLI tool that converts natural-language questions into validated SQL queries for configured SQL dialects (e.g., PostgreSQL). It connects to a local or remote database, uses an LLM (OpenAI by default) to generate SQL, and returns results or a dry-run of the query. Currently at version 1.0.0-beta.20, it requires Node >=20 and is under active beta development. Key differentiators: it validates generated SQL against the database schema, supports dry-run mode, and focuses on CLI-first interaction.

npm install askdb
INSTALL
IMPORT
SIG · ASKDB
A
askdb
databasejavascriptv1.0.0-beta.20
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AskDB
import AskDB from 'askdb'
Default export; CJS require not available.
askdb (CLI)
npx askdb "your question"
require('askdb') as a module directly
Primary use is CLI via npx; programmatic API is limited.

Initializes AskDB configuration and then asks a natural-language question to generate SQL.

npx askdb init npx askdb "show me all users who signed up last month"
Debug
Known issues
deprecatedThe package is in beta; APIs may change without major version bump.
fix
Pin to exact version and test upgrades.
affects: <1.0.0
gotchaAskDB requires a running database and schema to validate SQL. Without schema, queries may fail or hallucinate.
fix
Ensure 'askdb init' completes and database is accessible.
affects: >=0.0.1
gotchaCLI uses OpenAI by default; you must set OPENAI_API_KEY environment variable.
fix
Set OPENAI_API_KEY in your environment or configure another LLM provider.
affects: >=0.0.1
breakingVersion 1.0.0-beta.20 changed the configuration file format from .askdbrc to askdb.config.json.
fix
Rename or migrate configuration file to new format.
affects: >=1.0.0-beta.20
Errors
Common errors & fixes
Error: Cannot find module 'askdb'
Trying to require('askdb') in Node.js CJS or missing install.
fix
Use 'npx askdb' for CLI or import AskDB from 'askdb' in ESM context.
Error: Missing OPENAI_API_KEY
Environment variable not set.
fix
export OPENAI_API_KEY=your_key_here
Error: No database schema found
askdb init hasn't been run or database not accessible.
fix
Run 'npx askdb init' with correct database credentials.
Upgrade
Version history
1.0.0-beta.20latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
12
OpenAI (training)
1
Resources
packageaskdb
askdb — npm install askdb · libregistry