ClickHouse icon

ClickHouse

Query, insert, update, delete, and manage ClickHouse tables. Supports AI agent tool use with schema discovery, auto-pagination for large results, and parameterized queries.

Create Table

AI-generated

Summary

Create a ClickHouse table, optionally inferring schema from input items.

Inputs

  • table (required) — The name of the table to create
  • engine (required) — The ClickHouse table engine
  • inferSchema — Whether to infer column names and types from the input items. When disabled, you must specify columns manually.
  • columns — Define the columns manually
  • orderBy (required) — Comma-separated list of columns for ORDER BY (required for MergeTree family engines)
  • database — Override the database from credentials. Choose from the list, or specify an ID using an expression.
  • ifNotExists — Whether to add IF NOT EXISTS clause
  • partitionBy — Expression for the PARTITION BY clause
  • ttl — TTL expression for automatic data expiration

Output shape

a JSON object confirming table creation, containing success flag, table name, engine, and any provided options

No response body is returned on error; on success the object includes the executed DDL and any configuration details.

Examples

Example 1: Create a table with auto‑inferred schema

Table Name = users, inferSchema = true, Engine = MergeTree

Example 2: Create a table with explicit columns

Table Name = orders, Engine = ReplacingMergeTree, Columns = [{Name:id, Type=UInt64},{Name=status, Type=String}], Order By = id, If Not Exists = true

Example 3: Create a table only if it does not exist using a custom database

Table Name = logs, Engine = Log, Database = prod_logs, If Not Exists = true

Links

Discussion