# Application Developer Tool: SQL Query Editor

A query workspace pairing a schema sidebar of tables and row counts with a syntax tinted SQL editor and a results table with timing.

- Page: https://www.shadcn-ui-blocks.com/blocks/application-pro/developer-tools/sql-query-editor
- Collection: [Application](https://www.shadcn-ui-blocks.com/blocks/application-pro), Standard tier
- Group: [Developer Tools](https://www.shadcn-ui-blocks.com/blocks/application-pro/developer-tools)
- Created: 2026-07-14
- Preview image: https://www.shadcn-ui-blocks.com/blocks/application-pro/developer-tools/sql-query-editor.png

## Install

```bash
npx shadcn@latest add @shadcn-ui-blocks/application-pro-developer-tools-sql-query-editor
```

Needs an API key from a Pro or Team plan: add `@shadcn-ui-blocks` to the registries in components.json with the key as an `Authorization: Bearer` header. Setup: https://www.shadcn-ui-blocks.com/docs/shadcn-cli. The MCP server installs it without the setup: https://www.shadcn-ui-blocks.com/docs/mcp.

## Depends on

- npm packages: class-variance-authority, lucide-react, radix-ui
- shadcn/ui components: badge, button, table
- Installs to: `@/components/blocks/application-pro/developer-tools/sql-query-editor`

## About this block

SQL Query Editor is the analytics query workspace for
the acme_prod database, split into a schema sidebar and
an editor with a results table. The sidebar lists six
tables with row counts: subscriptions at 128,441 and
plans at 12 are the active pair, with customers,
invoices, events, and coupons below. The editor pane
carries line numbers and token tinted SQL, a monthly
recurring revenue query that joins subscriptions to
plans and groups by plan name. A Run query button sits
in the header beside a read replica badge, and the
results table returns 3 rows in 48 ms with an Export CSV
action, showing Scale, Growth, and Starter with their
customer counts and mrr.

Editor lines are a typed array of tone tagged segments,
and a toneClasses Record maps each tone to a class so
keywords, strings, and comments render without inline
colour. The schema tables and result rows are separate
const arrays.

## When to use

Reach for this block on a developer tools or analytics
page, wired to a read replica that runs the query and
streams the rows back. Keep the connection read only and
enforce the timeout server-side so a heavy query cannot
stall the primary.

A natural flow around it on an Application Pro page:

**Before**

- [Env vars manager](https://www.shadcn-ui-blocks.com/blocks/application-pro/developer-tools)
- [App shell](https://www.shadcn-ui-blocks.com/blocks/application-pro/app-shells)

**After**

- [Reports](https://www.shadcn-ui-blocks.com/blocks/application-pro/reports)
- [Charts](https://www.shadcn-ui-blocks.com/blocks/application-pro/charts)

## What you can display

One strong use is the read replica query console. Other
editor shapes:

- **Saved queries.** Add a sidebar tab for named queries
  so a team can rerun a report without retyping it.
- **Explain plan.** Swap the results tab for the query
  plan to show cost, scan type, and row estimates.
- **Query history.** List recent runs with duration and
  row count so slow queries stand out.

> Tip: show a real result set, not an empty grid; the
> returned rows are the proof that the editor runs.

## More in Application Developer Tools

- [Api Console](https://www.shadcn-ui-blocks.com/blocks/application-pro/developer-tools/api-console)
- [Build Status List](https://www.shadcn-ui-blocks.com/blocks/application-pro/developer-tools/build-status-list)
- [Cron Jobs Monitor](https://www.shadcn-ui-blocks.com/blocks/application-pro/developer-tools/cron-jobs-monitor)
- [Dependency Audit](https://www.shadcn-ui-blocks.com/blocks/application-pro/developer-tools/dependency-audit)
- [Deploy Panel](https://www.shadcn-ui-blocks.com/blocks/application-pro/developer-tools/deploy-panel)
- [Diff Viewer](https://www.shadcn-ui-blocks.com/blocks/application-pro/developer-tools/diff-viewer)
- [Env Vars Manager](https://www.shadcn-ui-blocks.com/blocks/application-pro/developer-tools/env-vars-manager)
- [Error Inbox](https://www.shadcn-ui-blocks.com/blocks/application-pro/developer-tools/error-inbox)
- [Feature Flags Panel](https://www.shadcn-ui-blocks.com/blocks/application-pro/developer-tools/feature-flags-panel)
- [Log Viewer](https://www.shadcn-ui-blocks.com/blocks/application-pro/developer-tools/log-viewer)
- [Migrations Panel](https://www.shadcn-ui-blocks.com/blocks/application-pro/developer-tools/migrations-panel)
- [SDK Quickstart](https://www.shadcn-ui-blocks.com/blocks/application-pro/developer-tools/sdk-quickstart)
- [Secrets Rotation Card](https://www.shadcn-ui-blocks.com/blocks/application-pro/developer-tools/secrets-rotation-card)
- [Terminal Panel](https://www.shadcn-ui-blocks.com/blocks/application-pro/developer-tools/terminal-panel)
- [Trace Waterfall](https://www.shadcn-ui-blocks.com/blocks/application-pro/developer-tools/trace-waterfall)
- [Webhook Logs Table](https://www.shadcn-ui-blocks.com/blocks/application-pro/developer-tools/webhook-logs-table)
