Generate lineage for ClickHouse assets App
To generate lineage for your ClickHouse assets, the ClickHouse Miner reads query history from system.query_log. Before you run the miner, query logging must be enabled and the crawler user must have access to that table. Once that's in place, you can run the miner to start building lineage.
Before you begin
Make sure you have:
- Set up ClickHouse by following Set up ClickHouse.
- Crawled ClickHouse metadata by following Crawl ClickHouse.
- ClickHouse 21.8 or later (recommended for full
system.query_logsupport).
Generate lineage
Validate your ClickHouse environment so the miner can extract query history from system.query_log.
-
Confirm that query logging is enabled. ClickHouse enables the
query_logtable by default. Verify by running:SELECT count(*) FROM system.query_log;If this query returns an error, query logging may be disabled. Check your ClickHouse server configuration (
config.xmlorconfig.d/) and make sure the<query_log>section is present:<query_log>
<database>system</database>
<table>query_log</table>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
</query_log> -
Grant the crawler user access to read from
system.query_log.GRANT SELECT ON system.query_log TO {{username}};- Replace
{{username}}with the ClickHouse user you configured when setting up ClickHouse.
- Replace
-
Verify that
system.query_logis collecting data. Run a sample query and then check that it appears in the log:SELECT 1;
SYSTEM FLUSH LOGS;
SELECT count(*) FROM system.query_log WHERE event_date = today(); -
To limit the query log retention period, configure
query_logTTL settings in your server configuration. The default TTL is sufficient for most deployments.
Run miner
After you confirm query logging is enabled, create and run the ClickHouse Miner workflow to extract query history and generate lineage:
- Follow Mine ClickHouse to select the ClickHouse Miner package and configure connection and extraction method.
- Run the miner once or on a schedule.
Once the miner completes, your existing ClickHouse assets are enriched with lineage from query history in system.query_log.
Need help
If you need help configuring the miner or enabling query logging, contact Atlan Support by submitting a request.