clickhouse-data-handling
БесплатноБез исполняемых скриптовНе проверенHandle data lifecycle in ClickHouse — TTL expiration, data deletion (GDPR), column-level encryption, and audit logging with real ClickHouse SQL. Use when…
от jeremylongshore★ 2 961 звезда на GitHubОб этом скилле
ClickHouse Data Handling
Overview
Manage the full data lifecycle in ClickHouse: TTL-based expiration, GDPR/CCPA
deletion, data masking, partition management, and audit trails. This skill
produces migration SQL and TypeScript client code you write into your project,
then verifies the results against ClickHouse system.* tables.
The workflow below is the high-level path — each step links to the full, copy-ready SQL/TypeScript in references/implementation.md, with end-to-end scenarios in references/examples.md.
Prerequisites
Before starting, confirm you have:
- Populated ClickHouse tables to operate on (schema comes from the companion
skill
clickhouse-core-workflow-a). - A written data-retention policy: how long each data class is kept, and which columns hold PII. The Data Classification table maps each class to its ClickHouse handling.
- ClickHouse 23.3+ if you plan to use lightweight
DELETE FROM; older versions must use mutation-basedALTER TABLE ... DELETE. - Access to
system.mutationsandsystem.partsto verify deletions.
Instructions
Work the six steps in order for a new table, or jump to the one you need. Use
Write/Edit to place the generated SQL into a migration file (or the
TypeScript into your data-access layer), then run it against ClickHouse and
verify via the system.* queries. Full code for each step lives in
references/implementation.md.
TTL-based expiration — attach a
TTLclause so data self-deletes, or use tieredTO VOLUMEstorage (hot → cold → delete) and column-level TTL to null out PII while keeping the row. Skeleton:ALTER TABLE analytics.events MODIFY TTL created_at + INTERVAL 90 DAY;GDPR/CCPA deletion — choose lightweight
DELETE FROM(23.3+), verifiableALTER TABLE ... DELETE(the compliant path), orDROP PARTITIONfor bulk. Always confirm completion insystem.mutations.Masking & anonymization — expose a
CREATE VIEWthatsipHash64-hashes identifiers and shows only email domains, gated by a dictionary allowlist.DSAR export & delete — the TypeScript
exportUserData/deleteUserDatahelpers loop every table for oneuser_idand log each deletion.Audit trail — an immutable, TTL-free
audit_logtable partitioned by month so retention actions are provable.Retention monitoring — a
system.tables/system.partsjoin that reports size, age span, and any MergeTree table missing a TTL.
Data Classification
| Category | Examples | Handling in ClickHouse |
|---|---|---|
| PII | Email, name, IP | Column-level TTL, masking views, deletion support |
| Sensitive | API keys, tokens | Never store in ClickHouse — use secret managers |
| Business | Event counts, metrics | Standard TTL, aggregate for long-term retention |
| Audit | Access logs | No TTL, immutable, partitioned by month |
Output
Applying this skill produces:
- Migration SQL —
CREATE TABLE/ALTER TABLEstatements adding TTL clauses, masking views, and the immutableaudit_logtable, ready to commit as a migration file. - TypeScript client code —
exportUserDataanddeleteUserDatafunctions for DSAR and erasure requests against@clickhouse/client. - Verification queries —
system.mutations/system.parts/system.tablesSELECTs that prove a deletion finished and flag tables missing retention. - An audit record — one immutable
audit_logrow per compliance action.
Error Handling
| Issue | Cause | Solution |
|---|---|---|
| Mutation stuck | Large table rewrite | Check system.mutations, cancel if needed |
| TTL not expiring | No merges running | OPTIMIZE TABLE ... FINAL to force |
| DELETE not working | Old ClickHouse version | Use ALTER TABLE DELETE (mutation) |
| Export timeout | Too much user data | Add LIMIT or export in batches |
Examples
A minimal TTL attach — the smallest useful action:
ALTER TABLE analytics.events
MODIFY TTL created_at + INTERVAL 90 DAY;
OPTIMIZE TABLE analytics.events FINAL; -- force the cleanup now
Full worked scenarios — a complete GDPR erasure (export → verifiable delete → audit log), standing up a retention-safe table with tiered storage, and auditing for tables missing a retention policy — are in references/examples.md. The step-by-step SQL and TypeScript each example composes lives in references/implementation.md.
Resources
- TTL for Data Management
- DELETE Statement
- Mutations
- [references/implementation.md](references/impl
Установить clickhouse-data-handling в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadWriteEditВложенные файлы
FAQ
Что делает скилл clickhouse-data-handling?
Handle data lifecycle in ClickHouse — TTL expiration, data deletion (GDPR), column-level encryption, and audit logging with real ClickHouse SQL. Use when implementing data retention, fulfilling GDPR/CCPA deletion requests, or managing sensitive data in ClickHouse. Trigger with "clickhouse data retention", "clickhouse TTL", "clickhouse GDPR", "delete data clickhouse", "clickhouse data lifecycle", "clickhouse PII".
Как установить скилл clickhouse-data-handling?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл clickhouse-data-handling запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic