/chtable

Grafana's table plugin for ClickHouse

Primary LanguageTypeScriptMIT LicenseMIT

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

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 CHTable panel to dashboard: select plugin
  • Choose ClickHouse as Data Source: select datasource
  • Type query into editor. For example:
SELECT
    number
FROM system.numbers
LIMIT $__limit

Where $__limit - is a special macros replaced with LIMIT N, M construction.

N = (current_page-1) * rows_per_page

M = rows_per_page

  • Set Format as to Table option
  • Go to Options tab and set params Rows per page=10 and Limit=50: options
  • 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.