historic_sql_table_digest

Convert historic SQL table usage buckets into typed table usage evidence for schema projection.

1.6k|101|Updated May 10, 2026
One-click install
npx skills add https://github.com/Kaelio/ktx --skill historic-sql-table-digest
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: historic_sql_table_digest
Source: https://github.com/Kaelio/ktx/tree/main/packages/cli/src/skills/historic_sql_table_digest
Command: npx skills add https://github.com/Kaelio/ktx --skill historic-sql-table-digest

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Warehouse teams accumulate historic SQL query logs, but turning raw per-table usage statistics into structured, trustworthy evidence for a semantic layer requires careful interpretation and identifier verification. This Skill standardizes that conversion so downstream schema projection receives consistent, typed table usage evidence.

Core Features & Use Cases

  • Usage Narrative Generation: Reads a staged tables/<schema>.<name>.json file from the historic-sql adapter and produces a concise narrative describing how the table is queried.
  • Typed Evidence Emission: Calls emit_historic_sql_evidence exactly once with a table_usage payload matching tableUsageOutputSchema, including frequency tier, common filters, group-bys, and joins.
  • Identifier Verification: Verifies schema.table identifiers via entity_details and sql_execution probes before referencing them, preventing fictional tables from entering the knowledge base.
  • Use Case: A memory agent processing a WorkUnit for public.orders uses this Skill to summarize that the table is heavily filtered by status and joined to customers, emitting one validated evidence object for deterministic schema projection.

Quick Start

Ask the agent to digest the staged historic SQL table file for a given schema.table and emit its table usage evidence.

Frequently Asked Questions about historic_sql_table_digest

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert historic SQL query logs into table usage evidence?

Stage the per-table JSON bucket from the historic-sql adapter, read the WorkUnit notes and raw file, then interpret columnsByClause, observedJoins, and stats buckets into a narrative and frequency tier. Emit the result once via emit_historic_sql_evidence with kind table_usage.

How is the frequency tier for a table determined?

The tier comes from stats.executionsBucket, stats.distinctUsersBucket, and stats.recencyBucket. Use high only when executions and distinct users are both broad, mid for repeated team usage, low for low-volume usage, and unused only when the input explicitly marks the table stale.

How are table identifiers verified before being used?

Call entity_details with the candidate identifier to confirm it resolves and inspect types and sample values. If it still does not resolve, probe with sql_execution; failing identifiers are marked unverified with the raw path cited or recorded via emit_unmapped_fallback.

What are the limitations of this table digest approach?

It processes exactly one table JSON file per run and emits only one evidence object. It cannot write wiki pages or semantic layer sources directly, and it must not invent columns, joins, or tables absent from the staged JSON.

Can this skill write to the wiki or semantic layer directly?

No. The skill explicitly forbids wiki_write, sl_write_source, sl_edit_source, and context_candidate_write. Its only output is a single typed evidence object consumed by downstream deterministic schema projection.