Commit graph

6 commits

Author SHA1 Message Date
Drew Davis
4cee5d698b
feat: Support ClickHouse datasource plugin macros in Raw SQL charts (#1922)
## Summary

This PR extends Raw SQL Charts to support [macros that are supported by the Grafana ClickHouse plugin](https://github.com/grafana/clickhouse-datasource?tab=readme-ov-file#macros).

Query Params and Macros are also now included as auto-complete suggestions in the SQL Editor.

### Screenshots or video

<img width="1434" height="1080" alt="Screenshot 2026-03-16 at 12 53 03 PM" src="https://github.com/user-attachments/assets/07f753e4-28f1-43f4-8add-f123dae0b12a" />

### How to test locally or on Vercel

This can be tested in Vercel preview - just reference the supported macros in a raw SQL chart.

### References



- Linear Issue: Closes HDX-3651
- Related PRs:
2026-03-17 17:23:14 +00:00
Drew Davis
33edc7e5be
feat: Improve auto-completion for SQLEditor (#1893)
## Summary

This PR

1. Refactors the SQLEditor and SQLInlineEditor to share code (and a directory) where possible.
2. Adds auto-complete to SQLEditor, for SQL Keywords, table names, database names, columns, map keys, and functions

The SQL editor autocompletion values are pulled from any tables that are registered in HyperDX as a source (or a materialized view on a source).

The PR is broken into one commit which is just file relocation and a second where the other changes are included.

### Screenshots or video

<img width="777" height="923" alt="Screenshot 2026-03-12 at 2 26 01 PM" src="https://github.com/user-attachments/assets/238bb46d-c459-4722-837c-b1682d971c32" />

### How to test locally or on Vercel

This can be tested in the preview environment.

Things to test include the `SQLEditor` for Raw SQL Charting and the `SQLInlineEditor` (used for WHERE and ORDER BY inputs, as well as in the SourceForm.

### References



- Linear Issue: Closes HDX-3620
- Related PRs:
2026-03-12 21:23:56 +00:00
Drew Davis
1e6fcf1c02
feat: Add raw sql line charts (#1866)
## Summary

This PR adds support for raw-sql-based line charts.

### Screenshots or video

https://github.com/user-attachments/assets/2c5cbdb6-491b-45fb-8864-0f45f34215b3

### How to test locally or on Vercel

This can be tested in the preview environment

### References

- Linear Issue: HDX-3581
- Related PRs:
2026-03-10 18:05:47 +00:00
Drew Davis
4641ab0eea
chore: Remove SQL charts toggle (#1867) 2026-03-09 14:14:37 -04:00
Drew Davis
fd9f290e2a
feat: Add query params, sorting, and placeholders to Raw-SQL tables (#1857)
Closes HDX-3580
Closes HDX-3034

## Summary

This PR enhances the support for SQL-driven tables

1. The selected date range can now be referenced in the query with query params. The available query params are outlined in a new section above the SQL input.
2. The table no longer OOMs on large result sets (it is now truncated to the first 10k results), or crashes when selecting columns that are Map or JSON type
3. The table can now be sorted client-side for sql-driven tables
4. There is now placeholder / example SQL in the input

### Screenshots or video

https://github.com/user-attachments/assets/4f39fd0a-d33e-4f8c-9e91-84143d23e293

### How to test locally or on Vercel

This feature can be tested locally or on the preview environment without any special toggles.

### References



- Linear Issue: HDX-3580
- Related PRs:
2026-03-06 16:05:34 +00:00
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