Widget
SQL query
Run any SQL query against your PostgreSQL database and display the result live. Ideal for surfacing business metrics, row counts, totals, or any data your database holds.
What it is for
Use SQL query widgets to pull live numbers from your database without writing a custom API. Track signups today, active subscriptions, error counts, revenue totals, anything a query can express. Results update on a schedule and can be visualized as text or charts.
How to add it
- Click + Add widget and select SQL query.
- Enter your PostgreSQL connection string.
- Write your query. The widget uses the first column of the first row as the displayed value.
- Save.
Configuration
| Field | Description |
|---|---|
| Label | Display name (e.g. "Active users today"). |
| Connection URL | PostgreSQL connection URL (postgres://user:pass@host:5432/dbname). |
| SQL Query | Any SELECT query. First column of first row is the displayed value. |
| Data type | Single value (displays first column of first row) or Structured data (displays all rows as a table). |
Tips
- Use
LIMIT 1to keep queries fast. - For table-style output, the widget can display multi-row results in a table view.
- Avoid queries that take more than a few seconds; they will time out.
Display options
Text, line chart (tracks the numeric value over time), bar chart, or table (multi-row results).
Credit cost
0.02 credits per check
Table
| user | plan | mrr |
|---|---|---|
| alice@acme.com | Pro | $420 |
| bob@corp.io | Enterprise | $1,200 |
| carol@startup.co | Pro | $420 |
| dan@agency.dev | Free | $0 |
09:18 PM · 1h · Top users by revenue
SQL Query
Chart
Active users
1420
09:18 PM · 1h
SQL QueryValue
Active users
1,420
09:18 PM · 1h
SQL Query