Agent skill

Clickhouse Materialized Column View Filter

by divinevideo in divinevideo/divine-mobile

Fix HTTP 500 / ClickHouse "column not found" errors when filtering by a MATERIALIZED column through a VIEW that doesn't expose it.

MPL-2.0Auto-check passedDatabases

Install Clickhouse Materialized Column View Filter

skills CLI
$ npx skills add divinevideo/divine-mobile --skill clickhouse-materialized-column-view-filter -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install divinevideo/divine-mobile clickhouse-materialized-column-view-filter --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/divinevideo/divine-mobile.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/clickhouse-materialized-column-view-filter .claude/skills/clickhouse-materialized-column-view-filter && rm -rf skills-src

Use ~/.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/

Facts

Skill name
clickhouse-materialized-column-view-filter
GitHub stars
266
Token cost
~1k tokens
SKILL.md length
379 words
Files
1
Skills in repo
103
Repo updated
First seen
Licence
MPL-2.0

At a glance

Fix HTTP 500 / ClickHouse "column not found" errors when filtering by a MATERIALIZED column through a VIEW that doesn't expose it.

  • Works in 3 steps: Query the view directly: SELECT platform… → API call with the filter param returns… → Run full smoke test suite to confirm no…
  • A WHERE clause references alias.column on a view but the column is MATERIALIZED on the underlying table
  • SKILL.md covers Problem, Context / Trigger Conditions, Solution and Verification, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Clickhouse Materialized Column View Filter is an agent skill from divinevideo/divine-mobile. Fix HTTP 500 / ClickHouse "column not found" errors when filtering by a MATERIALIZED column through a VIEW that doesn't expose it. Use when: (1) a WHERE clause references alias.column on a view but the column is MATERIALIZED on the underlying table, (2) the query works on the raw table but fails through the view, (3) adding a new filter param to an API causes 500 even though the column exists in the base table. Fix by using a subquery against the base table instead of referencing the column directly on the view…

Its SKILL.md is about 1k 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. The licence is MPL-2.0.

When your agent uses it

  • A WHERE clause references alias.column on a view but the column is MATERIALIZED on the underlying table
  • The query works on the raw table but fails through the view
  • Adding a new filter param to an API causes 500 even though the column exists in the base table

Example prompts

  • “column not found”
  • “/clickhouse-materialized-column-view-filter”

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. Query the view directly: SELECT platform FROM videos LIMIT 1 — should return data (or empty string for non-vine)
  2. API call with the filter param returns 200 instead of 500
  3. Run full smoke test suite to confirm no regressions

What it can do on your machine

Read from SKILL.md and the folder at commit 6487b05. It shows what the files ask for, not the result of running them.

  • Tool permissions

    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.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are sql).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Clickhouse Materialized Column View Filter loads about 1k tokens when it runs. Until then it costs about 159 tokens; SKILL.md has 379 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~159
When it runs · the whole SKILL.md, loaded when a task matches
~1k

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.

Safety

Auto-check passed

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.

SKILL.md

The full file from divinevideo/divine-mobile at commit 6487b05, republished under its MPL-2.0 licence (© divinevideo). 379 words, ~1,023 tokens.

Download SKILL.mdSave it as .claude/skills/clickhouse-materialized-column-view-filter/SKILL.md (or your agent's skills folder).
name
clickhouse-materialized-column-view-filter
description
Fix HTTP 500 / ClickHouse "column not found" errors when filtering by a MATERIALIZED column through a VIEW that doesn't expose it. Use when: (1) a WHERE clause references alias.column on a view but the column is MATERIALIZED on the underlying table, (2) the query works on the raw table but fails through the view, (3) adding a new filter param to an API causes 500 even though the column exists in the base table. Fix by using a subquery against the base table instead of referencing the column directly on the view. Applies to ClickHouse views over tables with MATERIALIZED or ALIAS columns.
author
Claude Code
version
1.0.0
date
2026-03-01

ClickHouse: MATERIALIZED Column Not Accessible Through VIEW

Problem

When a ClickHouse VIEW selects specific columns from a table (not SELECT *), any MATERIALIZED or ALIAS columns not explicitly included in the view's SELECT list are invisible to queries through the view. Attempting WHERE v.materialized_col = ? on such a view produces a "column not found" error, which surfaces as an HTTP 500 in API layers.

Context / Trigger Conditions

  • You add a new query filter (e.g., ?platform=vine) that references a column via a view alias
  • The column is defined as String MATERIALIZED ... on the underlying table
  • The VIEW was created with an explicit column list (not SELECT *)
  • The column works fine when querying the base table directly
  • The API returns HTTP 500 with no useful error message to the client
  • Server logs show a ClickHouse "column not found" or similar schema error

Solution

Option A: Subquery (No migration required)

Replace direct column reference with a subquery against the base table:

sql
-- BROKEN: view doesn't expose 'platform'
WHERE v.platform = ?

-- FIXED: subquery against the base table where MATERIALIZED column exists
WHERE v.id IN (
  SELECT id FROM events_deduped
  WHERE platform = ? AND kind IN (34235, 34236)
)
Option B: Migration (Cleaner long-term)

Create a new migration that drops and recreates the view to include the column:

sql
DROP VIEW IF EXISTS nostr.videos;
CREATE VIEW nostr.videos AS
SELECT
    id, pubkey, created_at, kind, content, tags, sig, indexed_at,
    d_tag, title, thumbnail, video_url, author_name, loops,
    platform,  -- ADD THE MATERIALIZED COLUMN
    if(published_at > 0, published_at, toUnixTimestamp(created_at)) AS published_at,
    expiration_at
FROM nostr.events_deduped FINAL
WHERE kind IN (34235, 34236);

Warning: Dropping a view cascades — any dependent views (video_stats, trending_videos, videos_with_loops, etc.) must also be dropped and recreated in the correct dependency order.

Verification

  1. Query the view directly: SELECT platform FROM videos LIMIT 1 — should return data (or empty string for non-vine)
  2. API call with the filter param returns 200 instead of 500
  3. Run full smoke test suite to confirm no regressions
Show full SKILL.md (139 more words)Show less

Example (Funnelcake)

The nostr.videos view (migration 000060) selects a fixed column list from events_deduped. The platform column is String MATERIALIZED on events_deduped but not in the view.

PR #85 added v.platform = ? to get_recent_videos_with_events() and get_trending_videos_with_events(), both of which query FROM videos v. This caused HTTP 500 for any request with ?platform=vine.

Fix (PR #86): Changed to subquery approach. Note that videos_with_loops (a different view) DOES include platform — queries through that view (like get_videos_filtered) work fine.

Notes

  • MATERIALIZED columns are physically stored but only accessible if explicitly selected
  • ALIAS columns are computed on read and have the same visibility constraint in views
  • Always check the view definition before adding WHERE conditions on columns
  • The videos_with_loops view includes more columns than videos — consider which view your query is actually using
  • In Funnelcake: videos view = minimal columns; videos_with_loops = full columns including platform

© divinevideo, MPL-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/clickhouse-materialized-column-view-filter of divinevideo/divine-mobile.

Open the folder on GitHubat commit 6487b05

Compare with similar skills

Clickhouse Materialized Column View Filter 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.

Clickhouse Materialized Column View Filter compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Clickhouse Materialized Column View Filter this skilldivinevideo/divine-mobile266—~1kAutomated safety check: PassMPL-2.0
Keeper Stress AnalysisClickHouse/ClickHouse50k—~4.7kAutomated safety check: PassApache-2.0
Perf ComparisonClickHouse/ClickHouse50k—~3.9kAutomated safety check: NotesApache-2.0
Patch Release CheckClickHouse/ClickHouse50k—~4kAutomated safety check: NotesApache-2.0
Clickhouse Architecture Advisorvemetric/vemetric3952 repos~791Automated safety check: PassApache-2.0
Decompress BinaryClickHouse/ClickHouse50k—~1.1kAutomated safety check: PassApache-2.0

Similar skills

  • Keeper Stress Analysis

    ClickHouse/ClickHouse

    Analyze ClickHouse Keeper stress-test results from play.clickhouse.com / keeperstresstests data warehouse.

    50k GitHub stars~4.7k tokensUpdated today
    DatabasesAuto-check passed
  • Perf Comparison

    ClickHouse/ClickHouse

    Evaluate ClickHouse performance test results from existing CI/dashboard data or local perf.py runs.

    50k GitHub stars~3.9k tokensUpdated today
    DatabasesAuto-check: notes
  • Patch Release Check

    ClickHouse/ClickHouse

    Check whether ClickHouse's supported versions (last 3 majors + latest LTS) have recent stable patch releases, diagnose why the scheduled AutoReleases pipeline failed, and identify which releases…

    50k GitHub stars~4k tokensUpdated today
    DatabasesAuto-check: notes
  • MUST USE when designing ClickHouse architectures, selecting between ingestion or modeling patterns, or translating best practices into workload-specific system designs.

    395 GitHub starsUsed in 2 repos~791 tokens
    DatabasesAuto-check passed
  • Decompress Binary

    ClickHouse/ClickHouse

    Extract the inner ELF from a ClickHouse self-extracting clickhouse binary, including when its architecture differs from the host (e.g.

    50k GitHub stars~1.1k tokensUpdated today
    DatabasesAuto-check passed
  • Good PRs

    ClickHouse/ClickHouse

    Show a report of open ClickHouse PRs whose only non-green CI check is "CH Inc sync" (or that are fully green) — i.e.

    50k GitHub stars~1.8k tokensUpdated today
    DatabasesAuto-check passed

More from divinevideo/divine-mobile

All 103 skills in this repo
  • Fix ArgoCD ExternalSecret deployment failing with "namespace X is not permitted in project Y".

    266 GitHub stars~931 tokensUpdated today
    Auto-check passed
  • Art Direct

    divinevideo/divine-mobile

    Art direction for any content — reads text, PDF, Word, HTML, PPT, then proposes 2-3 creative directions with photography style, mood, and visual language.

    266 GitHub stars~4.8k tokensUpdated today
    Auto-check passed
  • Async Await Null Race Condition

    divinevideo/divine-mobile

    Fix "Null check operator used on a null value" errors when an object is set to null during an async await.

    266 GitHub stars~881 tokensUpdated today
    Auto-check passed
  • AWS V4 Signing Custom Headers Gcs

    divinevideo/divine-mobile

    Add custom metadata headers (x-amz-meta-) to AWS v4 signed requests for GCS S3-compatible API.

    266 GitHub stars~1k tokensUpdated today
    Auto-check passed
  • Bash Herestring Newline Secrets

    divinevideo/divine-mobile

    Fix password/secret authentication failures caused by trailing newlines when creating Google Cloud secrets (or similar) with bash here-strings.

    266 GitHub stars~791 tokensUpdated today
    Auto-check passed
  • Fix silent video/media processing failures caused by URL extraction code that filters on file extensions (.mp4, .webm, .webp).

    266 GitHub stars~1.1k tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Clickhouse Materialized Column View Filter

What does Clickhouse Materialized Column View Filter do?

Fix HTTP 500 / ClickHouse "column not found" errors when filtering by a MATERIALIZED column through a VIEW that doesn't expose it. Clickhouse Materialized Column View Filter is an agent skill from divinevideo/divine-mobile. Fix HTTP 500 / ClickHouse "column not found" errors when filtering by a MATERIALIZED column through a VIEW that doesn't expose it.

When should I use Clickhouse Materialized Column View Filter?

Clickhouse Materialized Column View Filter fits situations like: A WHERE clause references alias.column on a view but the column is MATERIALIZED on the underlying table; the query works on the raw table but fails through the view; adding a new filter param to an API causes 500 even though the column exists in the base table.

How do I install Clickhouse Materialized Column View Filter in Claude Code?

Run `npx skills add divinevideo/divine-mobile --skill clickhouse-materialized-column-view-filter -a claude-code`. Or copy the skill folder (.agents/skills/clickhouse-materialized-column-view-filter in divinevideo/divine-mobile) into .claude/skills/clickhouse-materialized-column-view-filter in your project. Claude Code loads it when a task matches its description.

How do I install Clickhouse Materialized Column View Filter in Codex?

Run `npx skills add divinevideo/divine-mobile --skill clickhouse-materialized-column-view-filter -a codex`. Or copy the skill folder (.agents/skills/clickhouse-materialized-column-view-filter in divinevideo/divine-mobile) into .agents/skills/clickhouse-materialized-column-view-filter in your project. Codex loads it when a task matches its description.

Can I use Clickhouse Materialized Column View Filter in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add divinevideo/divine-mobile --skill clickhouse-materialized-column-view-filter -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-materialized-column-view-filter, .gemini/skills/clickhouse-materialized-column-view-filter, .github/skills/clickhouse-materialized-column-view-filter and .opencode/skills/clickhouse-materialized-column-view-filter in your project.

What does Clickhouse Materialized Column View Filter need to run?

SKILL.md names no scripts, command-line tools or credentials: Clickhouse Materialized Column View Filter is instructions for the agent only.

Does Clickhouse Materialized Column View Filter access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Clickhouse Materialized Column View Filter safe to install?

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.

What licence does Clickhouse Materialized Column View Filter use?

Clickhouse Materialized Column View Filter is published under the MPL-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Clickhouse Materialized Column View Filter use?

About 1k tokens (SKILL.md is roughly 4.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Clickhouse Materialized Column View Filter?

Skills that share tags, products or a category with Clickhouse Materialized Column View Filter: Keeper Stress Analysis (ClickHouse/ClickHouse, 50k stars), Perf Comparison (ClickHouse/ClickHouse, 50k stars), Patch Release Check (ClickHouse/ClickHouse, 50k stars) and Clickhouse Architecture Advisor (vemetric/vemetric, 395 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Clickhouse Materialized Column View Filter?

divinevideo (a GitHub organization) maintains it in divinevideo/divine-mobile, which has 266 GitHub stars. The repository holds 103 skills in this directory. The repository was last updated on October 9, 2026.

Source: divinevideo/divine-mobile on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.