Skip to content

Open-source ClickHouse CLI

Manage ClickHouse schemas
and sync API data.

Review migration SQL before applying it. Keep table definitions and API readers in your repository, alongside the code that uses them.

See the six-step example

TypeScript schema + API sync Python schema + migrations

Built byObsessionDBOpen source · MIT

Your repositorysrc/chkit.ts
01SchemaTables · Views · Types
02SourcesReaders · Mappings · State
chkitReview migrations. Run syncs.
ClickHouseTables and views ready to query.

Use your ClickHouse connection from the terminal or CI.

01 / Schema

Define tables and views.

Define ClickHouse tables, views, materialized views, and dictionaries in code. Import the schema from an existing database.

Define a schema

02 / Migrations & backfills

Migrate and backfill data.

Handle complex schema changes and backfill data across materialized views. Track progress and resume interrupted runs.

Explore backfills

03 / API Sync

Sync data from any source.

Build reliable syncs from HTTP APIs, databases, and other sources into ClickHouse.

Browse app integrations

Schema and API sync example

Start with a table, load 100 demo API records, then query posts per author. Change the view later using the data already stored in ClickHouse.

Install the packages and configure a ClickHouse connection before running the example. Add the TypeScript snippets to src/chkit.ts. For schema management without API sync, use the schema tutorial.

Define the columns once; the reader in step 3 writes into this table. The replacement engine and stable key let queries resolve repeated syncs to the latest version of each post.

src/chkit.ts
import { table } from '@chkit/core'
import { ingestionColumns } from '@chkit/plugin-ingest'
export const posts = table({
database: 'default', name: 'posts',
columns: [
{ name: 'id', type: 'String' },
{ name: 'title', type: 'String' },
{ name: 'user_id', type: 'UInt64' },
...ingestionColumns,
],
engine: 'ReplacingMergeTree(_chkit_ingested_at)',
primaryKey: ['id'], orderBy: ['id'],
})

Explore the schema DSL. Schema management is available in TypeScript and Python; this walkthrough uses TypeScript for API sync.

Compatible with