@askdb/core has 292 recorded weekly downloads on npm, a decrease of 60.8% over the past 30 days, ranking #2393 of 3,247 tracked listings.
About @askdb/core
@askdb/core
NL→SQL pipeline for AskDB. Provides ask() orchestration, schema/IR types, modes, logging, retrieval input, and the built-in dialect specs (PostgreSQL, CockroachDB, MySQL, MariaDB, SQLite, SQL Server). Pass a dialect id such as "postgres" and bring your own model; the engine packages (@askdb/postgres, …) add introspection, not SQL generation (ADR 0029).
Status: release candidate for 1.0 (
1.0.0-rc.N); the public API is frozen, and the release candidates fix bugs before 1.0.0.0.3.0moved the Postgres dialect and@askdb/core/postgresto@askdb/postgres. Runtime AI provider construction lives in@askdb/ai; core remains BYO-model and does not readprocess.env. Seedocs/adrs/0002-integration-package-layout.md,docs/adrs/0005-askdb-config-and-env-bootstrap.md, anddocs/adrs/0006-ai-provider-integration-strategy.md.
Security model:
ask()returns SQL and never executes it. Its SQL checks (singleSELECT/WITHstatement (with a SQL Server caveat), no comments, no write/DDL keywords, no locking reads, no known side-effecting functions, no Unicode-escapedU&"…"names on Postgres, and the tenant and sensitive-column checks) are heuristic defense in depth that catch common model mistakes. The read-only, sensitive-column and tenant checks all read SQL through one dialect-aware lexer, under readings that one module sets for each check and dialect (#815, which replaced the tenant check's separate scanner, #342). They are not a SQL parser and not a security boundary. Run generated SQL under a read-only, least-privilege database role and enforce tenant isolation in the database. See Safety boundaries.
Install
# `ai` (Vercel AI SDK) is a required peer dependency — your app owns its version
pnpm add @askdb/core ai
# Only to introspect a database (live, or offline from an export), its engine package:
pnpm add @askdb/postgres
# Plus a model — either construct one directly with an AI SDK provider:
pnpm add @ai-sdk/openai
# Optional AskDB config/env model factory (uses the @ai-sdk/* package above):
pnpm add @askdb/ai
ai is a peer dependency (^6.0.0 || ^7.0.51: AI SDK 6, or 7.0.51 and later), not a bundled dependency: ask() receives a LanguageModel your app constructs, so core must use the same ai instance your app does. Hosts on AI SDK 6 (e.g. @ai-sdk/openai@3) and AI SDK 7 (@ai-sdk/openai@4) are both supported. The config-driven path (@askdb/ai and @askdb/client) currently requires AI SDK 7.
ai is a required peer, not an optional one, and core loads it at import time. So any package that depends on @askdb/core needs ai installed, even for introspection only. That covers @askdb/client, @askdb/introspect, the engine packages, @askdb/prisma, @askdb/enrich and @askdb/rag. npm 7+ and pnpm install the missing peer for you. Yarn doesn't, so add ai yourself. ADR 0006 records why (2026-09 amendment).
@askdb/core itself does not depend on pg. The optional pg peer lives on @askdb/postgres for live Postgres introspection.
Runtime AI configuration helpers live in @askdb/ai, which has built-in providers for OpenAI, Azure/Foundry, Google, Anthropic, and the Vercel AI Gateway (install the matching @ai-sdk/* package). If you use @askdb/config, call bootstrapAskDbEnv(), create an AI registry, then pass getAskDbRuntimeConfig().ai.language to registry.createLanguageModelFromSection(...).
Schema format
@askdb/core reads the schema artifact: a split format designed for business-context enrichment and RAG chunking. See the schema artifact format for the full contract.
Directory layout
my-app.schema/
schema.json # physical layer — tables, columns, types, FKs, sensitive flags
tables/
users.md # describable layer — descriptions, aliases, common query language
orders.md
concepts.md # optional — cross-table vocabulary
Load a schema directory
import { loadSchema } from "@askdb/core";
const schema = loadSchema("./fixtures/schemas/orders-users.schema");
Minimal example — with the built-in Postgres dialect
import { ask, loadSchema } from "@askdb/core";
import { openai } from "@ai-sdk/openai";
const schema = loadSchema("./fixtures/schemas/orders-users.schema");
const { sql } = await ask({
question: "Top 5 customers by lifetime value?",
schema,
model: openai("gpt-4o"),
dialect: "postgres", // or POSTGRES_DIALECT from @askdb/core
});
Parameterized output (default on)
By default ask() also asks the model for an unbound form of the same SQL plus a small JSON parameter manifest. Every call is still exactly one model call — parameterize does not add or remove one, and nothing here lets a caller skip the model. The question is sent unchanged (values included); this is not a redaction feature.
import { ask, bindPreparedQuery, loadSchema } from "@askdb/core";
const result = await ask({
question: "How many cities does Colorado have?",
schema,
model: openai("gpt-4o"),
dialect: "postgres",
tenantScope,
});…
Description from the npm listing.
- askdb
- nl-to-sql
- natural-language-to-sql
- ai
- llm
- ai-sdk
- schema-v2
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (142)Similar npm AI SDKs plugins
All 20 @askdb/core alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/@askdb/core. First seen Nov 9, 2026; last successful collection Dec 6, 2026. See the methodology.