chtable
chtable copied to clipboard
Grafana's table plugin for ClickHouse
trafficstars
Table plugin for ClickHouse datasource
CHTable is a modification of Grafana's table plugin with next features:
- Real pagination - sending queries with
LIMITparameter based on page number - Query results caching for each page
- Detecting of total rows amount to build paging
Plugin works only with ClickHouse datasource
Quick start
Copy files to your Grafana plugin directory. Restart Grafana, check plugins list at http://your.grafana.instance/plugins.
How to use
- Configure ClickHouse datasource
- Add
CHTablepanel to dashboard:
- Choose
ClickHouseasData Source:
- Type query into editor. For example:
SELECT
number
FROM system.numbers
LIMIT $__limit
Where
$__limit- is a special macros replaced withLIMIT N, Mconstruction.N = (current_page-1) * rows_per_page
M = rows_per_page
- Set
Format astoTableoption - Go to
Optionstab and set paramsRows per page=10andLimit=50:
- Save dashboard and reload page. Try to navigate pages
Try to open Browser's Developer Tools and check sent requests
Options > Paging
Rows per page - how many rows to fetch from database at once
Limit - total number of rows. If blank - plugin will do select count() from $query to count this number.
If you don't want plugin to send extra query - set some value (like 1000)
License
MIT License, please see LICENSE for details.