Table plugin for ClickHouse datasource
CHTable is a modification of Grafana's table plugin with next features:
- Real pagination - sending queries with
LIMIT
parameter based on page number - Query results caching for each page
- Detecting of total rows amount to build paging
Plugin works only with ClickHouse datasource
Copy files to your Grafana plugin directory. Restart Grafana, check plugins list at http://your.grafana.instance/plugins.
- Configure ClickHouse datasource
- Add
CHTable
panel to dashboard: - Choose
ClickHouse
asData Source
: - Type query into editor. For example:
SELECT
number
FROM system.numbers
LIMIT $__limit
Where
$__limit
- is a special macros replaced withLIMIT N, M
construction.N = (current_page-1) * rows_per_page
M = rows_per_page
- Set
Format as
toTable
option - Go to
Options
tab and set paramsRows per page=10
andLimit=50
: - Save dashboard and reload page. Try to navigate pages
Try to open Browser's Developer Tools and check sent requests
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)
MIT License, please see LICENSE for details.