clickhouse-core-workflow-b

Featured

Insert, query, and aggregate data in ClickHouse with real SQL patterns. Use when writing analytical queries, inserting data at scale, building dashboards, or implementing materialized views. Trigger: "clickhouse query", "clickhouse insert", "clickhouse aggregate", "clickhouse materialized view", "clickhouse SQL".

AI & Automation 2,359 stars 334 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# ClickHouse Insert & Query (Core Workflow B) ## Overview Insert data efficiently and write analytical queries with aggregations, window functions, and materialized views. ## Prerequisites - Tables created (see `clickhouse-core-workflow-a`) - `@clickhouse/client` connected ## Instructions ### Step 1: Bulk Insert Patterns ```typescript import { createClient } from '@clickhouse/client'; const client = createClient({ url: process.env.CLICKHOUSE_HOST!, username: process.env.CLICKHOUSE_USER ?? 'default', password: process.env.CLICKHOUSE_PASSWORD ?? '', }); // Insert many rows efficiently — @clickhouse/client buffers internally await client.insert({ table: 'analytics.events', values: events, // Array of objects matching table columns format: 'JSONEachRow', }); // Insert from file (CSV, Parquet, etc.) import { createReadStream } from 'fs'; await client.insert({ table: 'analytics.events', values: createReadStream('./data/events.csv'), format: 'CSVWithNames', }); ``` **Insert best practices:** - Batch rows: aim for 10K-100K rows per INSERT (not one at a time) - ClickHouse creates a new "part" per INSERT — too many small inserts cause "too many parts" - For real-time streams, buffer 1-5 seconds then flush ### Step 2: Analytical Queries ```sql -- Top events by tenant in the last 7 days SELECT tenant_id, event_type, count() AS event_count, uniqExact(user_id) AS unique_users, min(created_at) AS first_see...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
8 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category