marmotdata/clickhouse
Discover databases, tables, and views from ClickHouse instances
The ClickHouse plugin discovers databases, tables, and views from ClickHouse instances. It extracts schema information, column details, and table metrics like row counts and storage sizes.
Connection Examples
Querying
This plugin lets Marmot run read-only SQL against a ClickHouse source for data queries. A statement's first keyword is checked outright: anything other than SELECT or WITH is refused before it reaches ClickHouse at all, and so is a statement that calls a table function reading data from outside ClickHouse itself (url, s3, file, remote, remoteSecure, cluster, mysql, postgresql, odbc, jdbc, hdfs, azureBlobStorage or input), since planning must never risk dialling out. Every surviving statement runs with the readonly setting, which ClickHouse enforces server-side by refusing writes, DDL and changes to settings; the native protocol also accepts one statement per call, so a statement can neither write nor smuggle a second one past a semicolon. readonly alone does not stop the table functions above, which is why they are refused outright rather than left to it.
Each statement is also planned with EXPLAIN PLAN, so ClickHouse does the SQL parsing, and every ReadFromMergeTree node in the plan is resolved to the same database.table MRN discovery gives that table. Views, normal and materialised, are expanded by the planner into the tables behind them, so a statement over a view names those tables rather than the view itself. A read the plan cannot name as a table this way, such as a non-MergeTree engine or a call to the dictGet family reading a dictionary, marks the plan incomplete instead, and the statement then needs a grant on the whole source.
None of this is a substitute for database-level permissions: readonly stops a statement from writing, but the connecting user's own grants are the real boundary on what it can read. Use a dedicated user with the built-in readonly settings profile and SELECT grants only on the databases it should query, rather than relying on Marmot alone:
CREATE USER marmot_reader IDENTIFIED WITH plaintext_password BY 'your-password' SETTINGS PROFILE 'readonly';
GRANT SELECT ON your_database.* TO marmot_reader;
Required Permissions
The user needs read access to system tables:
GRANT SELECT ON system.databases TO marmot_user;
GRANT SELECT ON system.tables TO marmot_user;
GRANT SELECT ON system.columns TO marmot_user;
For read-only discovery of all databases:
GRANT SHOW DATABASES ON *.* TO marmot_user;
GRANT SHOW TABLES ON *.* TO marmot_user;
GRANT SHOW COLUMNS ON *.* TO marmot_user;
In the UI
Point and click, no config file needed.
- Open Runs and choose Create pipeline.
- Pick ClickHouse from the plugin list.
- Fill in the settings, set a schedule and save.
With the CLI
Save a YAML config, then run marmot ingest.
Not using plugins? Other ways to populate Marmot
Configuration
Fields marked Required must be set.
tagsList of textTags to apply to discovered assets
external_linksList of groupsExternal links to show on all assets
nameTextDisplay name for the link
iconTextIcon identifier for the link
urlTextURL to the external resource
filterGroup of settingsFilter discovered assets by name (regex)
includeList of textInclude patterns for resource names (regex)
excludeList of textExclude patterns for resource names (regex)
zoneTextTells this system apart from others of the same technology and becomes part of every asset's MRN
hostText RequiredClickHouse server hostname or IP address
portNumberClickHouse native protocol port
userText RequiredUsername for authentication
passwordSecretPassword for authentication
databaseTextDefault database to connect to
secureYes or noUse TLS/SSL connection
include_databasesYes or noWhether to discover databases
include_columnsYes or noWhether to include column information in table metadata
enable_metricsYes or noWhether to include table metrics (row counts, sizes)
exclude_system_tablesYes or noWhether to exclude system tables
Assets emitted
Metadata this plugin attaches to each discovered asset.
Database
ClickHouse database-specific metadata fields.
Table
ClickHouse table-specific metadata fields.
Column
ClickHouse column-specific metadata fields.