Clickhouse Logs Queries
supabase/supabase
Write, review, and migrate Supabase logs queries against the ClickHouse-backed logs table (the logs.all.otel analytics endpoint).
A skill your agent uses when changing or reviewing Gram ClickHouse schemas, migrations, queries, inserts, access principals, bootstrap SQL, Cloud compatibility, partial migration failures, or…
$ npx skills add speakeasy-api/gram --skill clickhouse -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install speakeasy-api/gram clickhouse --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/speakeasy-api/gram.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/clickhouse .claude/skills/clickhouse && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "clickhouse" agent skill from https://github.com/speakeasy-api/gram/tree/main/.agents/skills/clickhouse into .claude/skills/clickhouse/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "clickhouse", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/speakeasy-api/gram/tree/main/.agents/skills/clickhouseType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add speakeasy-api/gram --skill clickhouse -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install speakeasy-api/gram clickhouse --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/speakeasy-api/gram.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.agents/skills/clickhouse .agents/skills/clickhouse && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "clickhouse" agent skill from https://github.com/speakeasy-api/gram/tree/main/.agents/skills/clickhouse into .agents/skills/clickhouse/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "clickhouse", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add speakeasy-api/gram --skill clickhouse -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install speakeasy-api/gram clickhouse --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/speakeasy-api/gram.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.agents/skills/clickhouse .cursor/skills/clickhouse && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "clickhouse" agent skill from https://github.com/speakeasy-api/gram/tree/main/.agents/skills/clickhouse into .cursor/skills/clickhouse/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "clickhouse", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/speakeasy-api/gram.git --path .agents/skills/clickhouse--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add speakeasy-api/gram --skill clickhouse -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install speakeasy-api/gram clickhouse --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/speakeasy-api/gram.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.agents/skills/clickhouse .gemini/skills/clickhouse && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "clickhouse" agent skill from https://github.com/speakeasy-api/gram/tree/main/.agents/skills/clickhouse into .gemini/skills/clickhouse/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "clickhouse", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install speakeasy-api/gram clickhouseInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add speakeasy-api/gram --skill clickhouse -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/speakeasy-api/gram.git skills-src && mkdir -p .github/skills && cp -r skills-src/.agents/skills/clickhouse .github/skills/clickhouse && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "clickhouse" agent skill from https://github.com/speakeasy-api/gram/tree/main/.agents/skills/clickhouse into .github/skills/clickhouse/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "clickhouse", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add speakeasy-api/gram --skill clickhouse -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install speakeasy-api/gram clickhouse --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/speakeasy-api/gram.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.agents/skills/clickhouse .opencode/skills/clickhouse && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "clickhouse" agent skill from https://github.com/speakeasy-api/gram/tree/main/.agents/skills/clickhouse into .opencode/skills/clickhouse/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "clickhouse", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
clickhouseA skill your agent uses when changing or reviewing Gram ClickHouse schemas, migrations, queries, inserts, access principals, bootstrap SQL, Cloud compatibility, partial migration failures, or…
Clickhouse is an agent skill from speakeasy-api/gram. Use when changing or reviewing Gram ClickHouse schemas, migrations, queries, inserts, access principals, bootstrap SQL, Cloud compatibility, partial migration failures, or performance for analytics, telemetry, risk, authz, and spend features
Its SKILL.md is about 3.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Databases, covering Data warehousing. It works with ClickHouse and SQL. The repository describes itself as: Securely scale AI usage across your organization. A single stack to Connect, Secure, Observe and Distribute agents, MCPs, and Skills within your company. The licence is AGPL-3.0.
3 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit ad78247. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
miseFrom the folder's file list and the shell code blocks in SKILL.md.
Links to these hosts (documentation or services it may open):
clickhouse.comFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Clickhouse loads about 3.2k tokens when it runs. Until then it costs about 63 tokens; SKILL.md has 1,453 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from speakeasy-api/gram at commit ad78247, republished under its AGPL-3.0 licence (© speakeasy-api). 1,453 words, ~3,233 tokens.
.claude/skills/clickhouse/SKILL.md (or your agent's skills folder).Gram conventions and the checked-in schema remain authoritative. Also use:
clickhouse-best-practices when reviewing or changing a ClickHouse schema, query, insert strategy, or configuration. Read its applicable rule files and cite the rules in review findings.clickhouse-architecture-advisor when choosing between ingestion patterns, raw tables and materialized views, partitioning or retention strategies, joins or enrichment, or mutable-state models.Local ClickHouse success is not proof of ClickHouse Cloud compatibility. Local containers and CI accept DDL and authentication settings that Cloud rejects.
| Object | Owner |
|---|---|
| Databases, users, roles, credentials, role settings | Terraform; never application schema migrations |
| Tables, views, materialized views, schema-bound grants/revokes | Atlas migrations, mirrored in golang-migrate |
| Local/CI/Atlas development-database prerequisites | local/clickhouse/initdb/01-marts-definer.sql |
Provision infrastructure prerequisites before applying dependent migrations. Do not put CREATE DATABASE, CREATE USER, or CREATE ROLE into desired schema files or either migration flavor, or drop infrastructure-owned objects in down migrations. If generation proposes these statements, fix the bootstrap/baseline and regenerate; do not accept them just because local replay passes.
Cloud footguns:
CREATE DATABASE ... ENGINE = Atomic is not supported in ClickHouse Cloud. Do not explicitly select the local database engine for Cloud.CREATE USER ... HOST NONE without authentication is still a passwordless user definition. Cloud's default policy rejects it; HOST NONE does not waive the password requirement. Never relax that policy to accommodate a definer.Local bootstrap is an exception, not a deployment template. 01-marts-definer.sql supplies the marts database, marts_reader role/limits, and marts_definer principal to local containers, CI replay, and Atlas's development database (server/atlas.hcl). Keep it idempotent. Its passwordless HOST NONE user is local-only; never copy it into Cloud provisioning or migrations.
For marts, edit server/clickhouse/mart.sql. Views use DEFINER = marts_definer SQL SECURITY DEFINER: reads of underlying tables run with the definer's privileges, not the reader's. Migrations own the definer's narrowly scoped source grants and the reader's grants on approved views, not the principals. Atlas ignores grants in desired state, so keep explicit matching grants/revokes in both migration flavors. See ClickHouse view SQL security.
ClickHouse migrations can fail after earlier statements have taken effect. Editing the failed file and rehashing does not reconcile those effects with Atlas's recorded progress; repeated in-place edits can leave the runner stuck.
atlas migrate set changes revision bookkeeping; it does not undo SQL. Only consider rewinding to the preceding revision and applying one migration after proving every statement is safe to replay and accounting for existing effects. IF NOT EXISTS alone does not prove existing objects have the intended definition.The ClickHouse schema is defined in server/clickhouse/schema.sql, with marts views in server/clickhouse/mart.sql. Edit the relevant desired schema file and generate a migration:
mise run clickhouse:diff <migration-name>This produces migrations in two flavors that must always stay in sync:
server/clickhouse/migrations/ — Atlas format. This is the source of truth: only these migrations are carried forward and applied in production.server/clickhouse/local/golang_migrate/ — golang-migrate format (.up.sql/.down.sql pairs). Used only for local development, so contributors without an Atlas Pro login can still run migrations.mise run clickhouse:diff generates both flavors together. When adjusting a newly generated, unpublished migration (for example, adding grants Atlas ignores), make the equivalent change in both directories, then run mise run clickhouse:hash to regenerate atlas.sum. Hashing updates checksums, not database or revision state. Apply pending migrations locally with mise run clickhouse:migrate.
No semicolons in COMMENT '...' strings. golang-migrate splits statements naively, so a semicolon inside a column/table comment breaks its parser and the local migrations fail to replay. Rephrase the comment instead.
Three CI checks guard this on every PR:
schema.sql without running mise run clickhouse:diff, this fails.server/clickhouse/migrations or server/clickhouse/local/golang_migrate) has a timestamp at or before the latest already on main. It also runs in the merge queue, so two PRs branched from the same head cannot both land and produce non-linear history (the INC-418 failure mode).Out-of-order timestamps. If migration-order reports a ClickHouse migration timestamp at or before the latest on main, do not rename files, hand-edit atlas.sum, or run atlas migrate rebase. Delete the generated Atlas migration and both matching golang-migrate .up.sql/.down.sql files, identified by migration name; update from main; then re-run mise run clickhouse:diff <name>. That regenerates both flavors on top with fresh, ordered timestamps and keeps them in sync. Avoid atlas migrate rebase: it renames only one dir (drifting the two flavors apart) and, for golang-migrate, moves an already-applied migration to a higher version so migrate up silently skips it on teammates' local databases.
The server/internal/telemetry package uses ClickHouse for high-performance analytics queries. Unlike PostgreSQL queries, ClickHouse queries are not auto-generated by SQLc. The telemetry repository uses Squirrel for dynamic query construction.
CRITICAL: Squirrel is permitted for ClickHouse repository code, including packages outside telemetry. Never use it for PostgreSQL queries; PostgreSQL repositories must use SQLc-generated code. Follow the target ClickHouse package's neighboring query and scan patterns.
telemetry_logsThe pre-aggregated materialized views are the default read path for anything that powers a dashboard, analytics surface, or filter control: trace_summaries, metrics_summaries, attribute_metrics_summaries, attribute_keys, chat_token_summaries. Query the raw telemetry_logs table only in the rare cases where per-log detail is genuinely required:
body,@user.region) that a fixed-column summary cannot express,Why it matters: raw telemetry_logs reads are full-range table scans with per-row JSON extraction; the summary views are pre-aggregated and cheap. A filter dropdown, summary card, count, or default list that scans raw logs on every page load is a performance bug — the unified Tool Logs page regressed exactly this way before being moved back onto trace_summaries. If a summary is missing a column you need, prefer extending the MV (+ a backfill migration) over falling back to a raw-log scan.
Reading trace_summaries (one row per trace_id, AggregatingMergeTree): GROUP BY trace_id, use *Merge combinators for AggregateFunction columns (anyIfMerge(http_status_code)) and plain any()/min()/sum()/max() for SimpleAggregateFunction columns. Tool calls carry a real trace_id (recorded by the gateway in ToolProxy.Do), so hosted MCP, shadow MCP, skill, and local tool events are all present in the view.
Gotcha —
ILLEGAL_AGGREGATION(code 184): when a grouped read is wrapped in a CTE/subquery that a caller then aggregates over (e.g.uniqExact(tool_name)over aWITH normalized_events AS (... GROUP BY trace_id ...)), ClickHouse merges the subquery back into the outer aggregate if an aggregate alias shadows a base column (any(gram_urn) AS gram_urn). Alias grouped aggregates to non-colliding names — prefix them, e.g.any(gram_urn) AS g_gram_urn— so the boundary holds.
queries.sql.go: Query implementations using squirrelpagination.go: Cursor pagination helpers (withPagination, withOrdering, etc.)README.md: Detailed documentation and patterns specific to ClickHouseWhen asked to add a new ClickHouse query to the telemetry package:
Create a params struct for query inputs
Build the query using squirrel (the sq var in queries.sql.go is pre-configured for ClickHouse):
type GetMetricsParams struct {
ProjectID string
DeploymentID string // optional
Limit int
}
func (q *Queries) GetMetrics(ctx context.Context, arg GetMetricsParams) ([]Metric, error) {
sb := sq.Select("id", "value", "timestamp").
From("metrics").
Where("project_id = ?", arg.ProjectID)
// Optional filters - explicit conditionals for clarity
if arg.DeploymentID != "" {
sb = sb.Where(squirrel.Eq{"deployment_id": arg.DeploymentID})
}
sb = sb.Limit(uint64(arg.Limit))
query, args, err := sb.ToSql()
if err != nil {
return nil, fmt.Errorf("building query: %w", err)
}
rows, err := q.conn.Query(ctx, query, args...)
// ... handle rows
}Use pagination helpers from pagination.go:
withPagination(sb, cursor, sortOrder) - cursor paginationwithOrdering(sb, sortOrder, primaryCol, secondaryCol) - ORDER BYtestenv.Launch or testenv.NewTestClickhouse) and a real ClickHouse container.async_insert=0, read directly after the insert.async_insert=1, wait_for_async_insert=1, read directly after the insert returns.async_insert=1, wait_for_async_insert=0, call testenv.FlushClickHouseAsyncInserts(t, conn) after the application issues the write and before reading. Synchronize any application goroutine first; do not use time.Sleep or polling to wait for the async queue.clickhouse.WithAsync(false) to request synchronous insertion: it enables fire-and-forget async inserts. Omit async options or set async_insert=0 explicitly.it-prefix names and helper functions for test data insertion.See server/internal/telemetry/README.md for comprehensive documentation.
© speakeasy-api, AGPL-3.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in .agents/skills/clickhouse of speakeasy-api/gram.
Open the folder on GitHubat commit ad78247
Clickhouse next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Clickhouse this skillspeakeasy-api/gram | 272 | — | ~3.2k | Automated safety check: Pass | AGPL-3.0 | |
| Clickhouse Logs Queriessupabase/supabase | 111k | — | ~2.4k | Automated safety check: Pass | Apache-2.0 | |
| Chdb SQLvemetric/vemetric | 394 | 1 repos | ~1.2k | Automated safety check: Pass | Apache-2.0 | |
| BisectClickHouse/ClickHouse | 50k | — | ~1.4k | Automated safety check: Pass | Apache-2.0 | |
| Clickhouse System QueriesFrankChen021/datastoria | 327 | — | ~731 | Automated safety check: Pass | Custom licence | |
| Webapp Buildersidequery/sidemantic | 129 | — | ~5.5k | Automated safety check: Pass | AGPL-3.0 |
supabase/supabase
Write, review, and migrate Supabase logs queries against the ClickHouse-backed logs table (the logs.all.otel analytics endpoint).
vemetric/vemetric
A skill your agent uses when the user wants to run SQL — especially analytical SQL — on local files (parquet/csv/json), URLs, S3 paths, or remote databases (Postgres, MySQL, MongoDB, ClickHouse…
ClickHouse/ClickHouse
Bisect a ClickHouse regression using pre-built master binaries from CI.
FrankChen021/datastoria
Query ClickHouse system tables to inspect query logs, monitor cluster health, check replication status, and analyze slow queries.
sidequery/sidemantic
Build interactive analytics webapps, demos, dashboards, or embedded app surfaces from Sidemantic semantic models using copyable component primitives and deterministic query inspection.
ClickHouse/ClickHouse
Profile a ClickHouse query using the sampling query profiler and system.tracelog.
speakeasy-api/gram
A skill your agent uses when automating the Gram dashboard in a browser, capturing screenshots, inspecting pages.
speakeasy-api/gram
A skill your agent uses when adding, changing, restyling, reviewing, validating, or previewing a Gram/Speakeasy transactional email, in Go or in LMX/MJML — a template<name.go, a TemplateKey…
speakeasy-api/gram
A skill your agent uses when adding, changing, or styling UI in client/admin (the Gram admin dashboard) that touches shadcn/ui — a button, dialog, table, sidebar, badge, select, tabs, tooltip, card…
speakeasy-api/gram
A skill your agent uses when adding, editing, reviewing, testing, or locating a reviewed skill distributed with the Platform MCP plugin; triggers include "Platform MCP skill", "platformmcpskills"…
speakeasy-api/gram
A skill your agent uses when gating a feature behind a flag, dogfooding or gradually rolling out a change, choosing between productfeatures and PostHog feature flags, adding or checking a product…
speakeasy-api/gram
How to build and run GCP Pub/Sub stream subscribers in Python under pystreams/ — the multi command (start at pystreams/src/pystreams/cmd/multi.py), the graminfra.pubsub publisher/subscriber library…
Works with
Categories
A skill your agent uses when changing or reviewing Gram ClickHouse schemas, migrations, queries, inserts, access principals, bootstrap SQL, Cloud compatibility, partial migration failures, or…. Clickhouse is an agent skill from speakeasy-api/gram.
Clickhouse fits situations like: reviewing Gram ClickHouse schemas; access principals; cloud compatibility; partial migration failures.
Run `npx skills add speakeasy-api/gram --skill clickhouse -a claude-code`. Or copy the skill folder (.agents/skills/clickhouse in speakeasy-api/gram) into .claude/skills/clickhouse in your project. Claude Code loads it when a task matches its description.
Run `npx skills add speakeasy-api/gram --skill clickhouse -a codex`. Or copy the skill folder (.agents/skills/clickhouse in speakeasy-api/gram) into .agents/skills/clickhouse in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add speakeasy-api/gram --skill clickhouse -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/clickhouse, .gemini/skills/clickhouse, .github/skills/clickhouse and .opencode/skills/clickhouse in your project.
Going by SKILL.md and its folder, Clickhouse needs the command-line tools its instructions call (mise).
SKILL.md names 1 domain. As links in the text: clickhouse.com. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Clickhouse is published under the AGPL-3.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 3.2k tokens (SKILL.md is roughly 13k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Clickhouse: Clickhouse Logs Queries (supabase/supabase, 111k stars), Chdb SQL (vemetric/vemetric, 394 stars), Bisect (ClickHouse/ClickHouse, 50k stars) and Clickhouse System Queries (FrankChen021/datastoria, 327 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
speakeasy-api (a GitHub organization) maintains it in speakeasy-api/gram, which has 272 GitHub stars. The repository holds 39 skills in this directory. The repository was last updated on October 8, 2026.
Source: speakeasy-api/gram on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.