Skip to main content

ClickHouse Operations CLI — health checks, data quality, schema migrations, and observability

Project description

chops

ClickHouse Operations CLI — health checks, data quality profiling, schema migrations, and observability from your terminal.

No more copy-pasting system table queries. One command to check cluster health, profile data quality, manage schema migrations, or find slow queries.

Quick Start

# Run directly with uvx (no install needed)
uvx chops health summary

# Or install with pip
pip install chops

Configuration

Set environment variables or pass flags:

export CLICKHOUSE_HOST=localhost
export CLICKHOUSE_PORT=8123
export CLICKHOUSE_USER=default
export CLICKHOUSE_PASSWORD=

Or use flags: chops --host myserver --user admin health summary

Commands

Health & Observability

Command Description
chops health summary Cluster overview: version, uptime, databases, tables, parts, merges, queries
chops health table-sizes Disk usage by table, sorted by size
chops health slow-queries Top N slowest queries from query log
chops health merges Currently running merge operations
chops health running-queries Active queries with elapsed time and memory

Data Quality

Command Description
chops dq profile <table> Column-level profiling: null rates, cardinality, min/max
chops dq check <table> Run quality checks with configurable thresholds (CI-friendly exit codes)
chops dq freshness <table> Time since last row — OK/WARNING/CRITICAL with exit codes

Schema Migrations

Command Description
chops migrate init Create migrations directory
chops migrate new <name> Generate a timestamped migration file with up/down sections
chops migrate status Show applied vs pending migrations
chops migrate up Apply pending migrations (all or --steps N)
chops migrate down --confirm Revert most recent migration(s)

Examples

# Quick cluster health check
chops health summary

# Find which tables are eating disk
chops health table-sizes --limit 10

# Slowest queries in the last 6 hours
chops health slow-queries --hours 6

# Profile a table's data quality
chops dq profile mydb.events

# Run quality checks in CI (non-zero exit on failure)
chops dq check mydb.events --max-null-pct 5 --min-rows 1000

# Check if a streaming table is still receiving data
chops dq freshness mydb.events --warn 60 --critical 1440

# JSON output for automation
chops dq profile mydb.events --output json

# Schema migrations
chops migrate init
chops migrate new "add_user_scores_table"
chops migrate up
chops migrate status
chops migrate down --confirm

Migration files use a simple format with -- migrate:up and -- migrate:down sections:

-- migrate:up
CREATE TABLE mydb.user_scores (
    user_id UInt64,
    score Float32,
    updated_at DateTime DEFAULT now()
)
ENGINE = ReplacingMergeTree(updated_at)
ORDER BY user_id;

-- migrate:down
DROP TABLE IF EXISTS mydb.user_scores;

CI/CD Integration

chops dq check and chops dq freshness return non-zero exit codes on failure, making them usable in CI pipelines:

- name: Data quality gate
  run: |
    chops dq check production.orders --max-null-pct 2 --min-rows 10000
    chops dq freshness production.orders --warn 30 --critical 120

Development

git clone https://github.com/antonio-mello-ai/chops.git
cd chops
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

# Run tests
pytest

# Lint
ruff check src/ tests/

# Type check
mypy src/

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chops-0.3.0.tar.gz (58.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chops-0.3.0-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file chops-0.3.0.tar.gz.

File metadata

  • Download URL: chops-0.3.0.tar.gz
  • Upload date:
  • Size: 58.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for chops-0.3.0.tar.gz
Algorithm Hash digest
SHA256 86e9d49ff6f64d2adcdb3c9924ddba5d5b4df03bcf5b561732e36cdfb1c7edab
MD5 9a55ab8648e59fa3e6f39a09e68f15f6
BLAKE2b-256 7db03056d5e5028123676d8daee15c1f85bc44af02cc0f948f88671856d7d3b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for chops-0.3.0.tar.gz:

Publisher: publish.yml on antonio-mello-ai/chops

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chops-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: chops-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for chops-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ae4b0d82c1055251cf88f0b87bfcc75b1d3ec6f71b01e9490136547904946ed
MD5 49213576544e1fe34c9f11bafd69cf68
BLAKE2b-256 682534831dd261aa0e03e5f3c7f6645f750885c9eaf15aa152c81d07f2aaaf60

See more details on using hashes here.

Provenance

The following attestation bundles were made for chops-0.3.0-py3-none-any.whl:

Publisher: publish.yml on antonio-mello-ai/chops

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page