hyperdx/packages/api
Drew Davis 32f1189a7d
feat: Add RawSqlChartConfig types for SQL-based Table (#1846)
## Summary



This PR is the first step towards raw SQL-driven charts. 
- It introduces updated ChartConfig types, which are now unions of `BuilderChartConfig` (which is unchanged from the current `ChartConfig` types` and `RawSqlChartConfig` types which represent sql-driven charts. 
- It adds _very basic_ support for SQL-driven tables in the Chart Explorer and Dashboard pages. This is currently behind a feature toggle and enabled only in preview environments and for local development.

The changes in most of the files in this PR are either type updates or the addition of type guards to handle the new ChartConfig union type. 

The DBEditTimeChartForm has been updated significantly to (a) add the Raw SQL option to the table chart editor and (b) handle conversion from internal form state (which can now include properties from either branch of the ChartConfig union) to valid SavedChartConfigs (which may only include properties from one branch).

Significant changes are in:
- packages/app/src/components/ChartEditor/types.ts
- packages/app/src/components/ChartEditor/RawSqlChartEditor.tsx
- packages/app/src/components/ChartEditor/utils.ts
- packages/app/src/components/DBEditTimeChartForm.tsx
- packages/app/src/components/DBTableChart.tsx
- packages/app/src/components/SQLEditor.tsx
- packages/app/src/hooks/useOffsetPaginatedQuery.tsx

Future PRs will add templating to the Raw SQL driven charts for date range and granularity injection; support for other chart types driven by SQL; improved placeholder, validation, and error states; and improved support in the external API and import/export.

### Screenshots or video

https://github.com/user-attachments/assets/008579cc-ef3c-496e-9899-88bbb21eaa5e

### How to test locally or on Vercel

The SQL-driven table can be tested in the preview environment or locally. 

### References



- Linear Issue: HDX-3580
- Related PRs:
2026-03-05 20:30:58 +00:00
..
docs/auto_provision feat: Set up default sources/connections with env var in server mode (#817) 2025-05-16 23:17:37 +00:00
migrations chore: Update to next 16, react 19, add react compiler (#1434) 2025-12-04 23:40:59 +00:00
scripts chore: Add automatic api doc generation (#1397) 2025-11-21 21:14:02 +00:00
src feat: Add RawSqlChartConfig types for SQL-based Table (#1846) 2026-03-05 20:30:58 +00:00
.Dockerignore first commit 2023-09-12 20:08:05 -07:00
.env.development fix: Avoid using bodyExpression for trace sources (#1722) 2026-02-11 13:01:12 +00:00
.env.e2e chore: Use local clickhouse instance for playwright tests (#1711) 2026-02-13 15:43:12 +00:00
.env.test chore: Run integration tests on different ports (#1801) 2026-02-25 20:52:17 +00:00
CHANGELOG.md Release HyperDX (#1790) 2026-02-27 08:38:01 -08:00
Dockerfile fix: Set correct github URL as image source in Dockerfiles (#1698) 2026-02-04 16:11:31 +00:00
eslint.config.mjs chore(eslint): add @typescript-eslint/no-unsafe-type-assertion rule (#1534) 2025-12-30 16:01:11 +00:00
jest.config.js ci: port v1 metric tests - Pt1 (#638) 2025-02-27 08:07:47 +00:00
jest.setup.ts Clean Up Integration Test Console Output (#1566) 2026-01-07 17:38:01 +00:00
migrate-mongo-config.ts feat: setup clickhouse migration tool + update metrics schema (add is_delta + is_monotonic fields) (#138) 2023-12-03 14:06:50 -08:00
nodemon.json Improve common-utils build performance and add support for .env.local (#1466) 2025-12-11 23:07:16 +00:00
openapi.json feat: support saved query/filter values in external api (#1814) 2026-03-04 16:45:18 +00:00
package.json fix: add whereLanguage to tile alerts (#1842) 2026-03-04 18:54:10 +00:00
tsconfig.build.json fix: Update tsconfigs to resolve IDE type errors (#1150) 2025-09-11 08:55:14 -04:00
tsconfig.json Clean Up Integration Test Console Output (#1566) 2026-01-07 17:38:01 +00:00