Skip to Content

Clickhouse

Clickhouse icon
Community

Tools to query and explore a ClickHouse database

Author:Arcade
Version:0.4.0
Auth:No authentication required
5tools
5require secrets
PyPI VersionPython VersionsWheel StatusDownloadsLicense

ClickHouse toolkit provides tools to explore and query a ClickHouse database, enabling safe schema discovery and read-only SELECT execution. It helps discover databases and tables, inspect table schemas, and run constrained SELECT queries that follow ClickHouse best practices.

Capabilities

  • Discover database and table topology and surface a default schema name.
  • Retrieve precise table schemas to drive safe query construction.
  • Execute read-only SELECTs with enforced rules (explicit columns, ordering, indexed joins, case sensitivity).
  • Surface query guidance to avoid common ClickHouse pitfalls.

Secrets Secret types: password, unknown. Example: CLICKHOUSE_DATABASE_CONNECTION_STRING — a connection string containing host, port, database and credentials (including password).

Available tools(5)

5 of 5
Tool nameDescriptionSecrets
Discover all the databases in the ClickHouse database.
1
Discover all the schemas in the ClickHouse database. Note: ClickHouse doesn't have schemas like PostgreSQL, so this returns a default schema name.
1
Discover all the tables in the ClickHouse database when the list of tables is not known. ALWAYS use this tool before any other tool that requires a table name.
1
You have a connection to a ClickHouse database. Execute a SELECT query and return the results against the ClickHouse database. No other queries (INSERT, UPDATE, DELETE, etc.) are allowed. ONLY use this tool if you have already loaded the schema of the tables you need to query. Use the <GetTableSchema> tool to load the schema if not already known. The final query will be constructed as follows: SELECT {select_query_part} FROM {from_clause} JOIN {join_clause} WHERE {where_clause} HAVING {having_clause} ORDER BY {order_by_clause} LIMIT {limit} OFFSET {offset} When running queries, follow these rules which will help avoid errors: * Never "select *" from a table. Always select the columns you need. * Always order your results by the most important columns first. If you aren't sure, order by the primary key. * Always use case-insensitive queries to match strings in the query. * Always trim strings in the query. * Prefer LIKE queries over direct string matches or regex queries. * Only join on columns that are indexed or the primary key. Do not join on arbitrary columns. * ClickHouse is case-sensitive, so be careful with table and column names.
1
Get the schema/structure of a ClickHouse table in the ClickHouse database when the schema is not known, and the name of the table is provided. This tool should ALWAYS be used before executing any query. All tables in the query must be discovered first using the <DiscoverTables> tool.
1

Selected tools

No tools selected.

Click "Show all tools" to add tools.

Requirements

Select tools to see requirements

#

Clickhouse.DiscoverDatabases

Discover all the databases in the ClickHouse database.

Parameters

No parameters required.

Requirements

Secrets:CLICKHOUSE_DATABASE_CONNECTION_STRING

Output

Type:arrayNo description provided.
#

Clickhouse.DiscoverSchemas

Discover all the schemas in the ClickHouse database. Note: ClickHouse doesn't have schemas like PostgreSQL, so this returns a default schema name.

Parameters

No parameters required.

Requirements

Secrets:CLICKHOUSE_DATABASE_CONNECTION_STRING

Output

Type:arrayNo description provided.
#

Clickhouse.DiscoverTables

Discover all the tables in the ClickHouse database when the list of tables is not known. ALWAYS use this tool before any other tool that requires a table name.

Parameters

No parameters required.

Requirements

Secrets:CLICKHOUSE_DATABASE_CONNECTION_STRING

Output

Type:arrayNo description provided.
#

Clickhouse.ExecuteSelectQuery

You have a connection to a ClickHouse database. Execute a SELECT query and return the results against the ClickHouse database. No other queries (INSERT, UPDATE, DELETE, etc.) are allowed. ONLY use this tool if you have already loaded the schema of the tables you need to query. Use the <GetTableSchema> tool to load the schema if not already known. The final query will be constructed as follows: SELECT {select_query_part} FROM {from_clause} JOIN {join_clause} WHERE {where_clause} HAVING {having_clause} ORDER BY {order_by_clause} LIMIT {limit} OFFSET {offset} When running queries, follow these rules which will help avoid errors: * Never "select *" from a table. Always select the columns you need. * Always order your results by the most important columns first. If you aren't sure, order by the primary key. * Always use case-insensitive queries to match strings in the query. * Always trim strings in the query. * Prefer LIKE queries over direct string matches or regex queries. * Only join on columns that are indexed or the primary key. Do not join on arbitrary columns. * ClickHouse is case-sensitive, so be careful with table and column names.

Parameters

ParameterTypeReq.Description
select_clausestringRequiredThis is the part of the SQL query that comes after the SELECT keyword wish a comma separated list of columns you wish to return. Do not include the SELECT keyword.
from_clausestringRequiredThis is the part of the SQL query that comes after the FROM keyword. Do not include the FROM keyword.
limitintegerOptionalThe maximum number of rows to return. This is the LIMIT clause of the query. Default: 100.
offsetintegerOptionalThe number of rows to skip. This is the OFFSET clause of the query. Default: 0.
join_clausestringOptionalThis is the part of the SQL query that comes after the JOIN keyword. Do not include the JOIN keyword. If no join is needed, leave this blank.
where_clausestringOptionalThis is the part of the SQL query that comes after the WHERE keyword. Do not include the WHERE keyword. If no where clause is needed, leave this blank.
having_clausestringOptionalThis is the part of the SQL query that comes after the HAVING keyword. Do not include the HAVING keyword. If no having clause is needed, leave this blank.
group_by_clausestringOptionalThis is the part of the SQL query that comes after the GROUP BY keyword. Do not include the GROUP BY keyword. If no group by clause is needed, leave this blank.
order_by_clausestringOptionalThis is the part of the SQL query that comes after the ORDER BY keyword. Do not include the ORDER BY keyword. If no order by clause is needed, leave this blank.
with_clausestringOptionalThis is the part of the SQL query that comes after the WITH keyword when basing the query on a virtual table. If no WITH clause is needed, leave this blank.

Requirements

Secrets:CLICKHOUSE_DATABASE_CONNECTION_STRING

Output

Type:arrayNo description provided.
#

Clickhouse.GetTableSchema

Get the schema/structure of a ClickHouse table in the ClickHouse database when the schema is not known, and the name of the table is provided. This tool should ALWAYS be used before executing any query. All tables in the query must be discovered first using the <DiscoverTables> tool.

Parameters

ParameterTypeReq.Description
schema_namestringRequiredThe schema to get the table schema of
table_namestringRequiredThe table to get the schema of

Requirements

Secrets:CLICKHOUSE_DATABASE_CONNECTION_STRING

Output

Type:arrayNo description provided.
Last updated on