semantic-sql-history-profiler

Mine historical SQL execution data to extract column usage patterns and join relationships.

1.5k|222|Updated Jul 4, 2025
One-click install
npx skills add https://github.com/Datus-ai/Datus-agent --skill semantic-sql-history-profiler
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: semantic-sql-history-profiler
Source: https://github.com/Datus-ai/Datus-agent/tree/main/datus/resources/skills/semantic-sql-history-profiler
Command: npx skills add https://github.com/Datus-ai/Datus-agent --skill semantic-sql-history-profiler

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Manually authoring semantic models requires guessing column business meanings, join relationships, and valid value ranges, leading to inaccurate SQL generation, broken metrics, and hours of redundant schema inspection for data teams.

Core Features & Use Cases

  • Historical SQL Mining: Extracts join relationships, dimension candidates, measure candidates, and common filter templates directly from existing successful SQL queries instead of relying on guesswork.
  • Bounded Column Profiling: Offers three profiling modes (sql_only for speed, lightweight for sampled distributions, deep for exhaustive analysis) with configurable resource limits to avoid overloading production systems.
  • Use Case: A data team building a MetricFlow semantic model for sales data can use this skill to profile 6 months of historical sales queries, automatically identifying that order_status is a dimension with 4 distinct values and order_total is a measure with a valid range of $10 to $10,000, cutting model authoring time by 70%.

Quick Start

Use the semantic-sql-history-profiler skill to analyze the provided historical e-commerce SQL queries and generate profiling evidence for your new sales semantic model.

Frequently Asked Questions about semantic-sql-history-profiler

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

FAQPage Schema
How do I extract join relationships for a MetricFlow semantic model from historical SQL?

Profiling column distributions for semantic model authoring involves analyzing historical SQL execution data to identify valid value ranges and distinct counts. It provides actionable evidence for dimension and measure definitions, ensuring accurate data distribution mapping in the YAML output.

What is the best way to author dbt YAML semantic models without manual schema inspection?

The best way to author dbt YAML semantic models without manual schema inspection is using bounded SQL history profiling. This method automatically extracts dimension candidates, measure definitions, and relationship hints from existing successful queries, cutting authoring time by 70%.

Can I use SQL history profiling without overloading my production database?

You can use SQL history profiling without overloading production systems by selecting bounded resource limits. The profiler offers sql_only, lightweight, and deep profiling modes to control resource consumption and prevent excessive database strain.

How does semantic SQL history profiling improve LLM-powered SQL generation?

Semantic SQL history profiling improves LLM-powered SQL generation by providing accurate dimension candidates, measure definitions, and relationship hints based on real query history. This ensures the semantic layer accurately reflects business logic and valid data distributions.

What are the limitations of using deep profiling mode for SQL history analysis?

A limitation of deep profiling mode for SQL history analysis is its high resource consumption, as it performs exhaustive column distribution analysis. While it delivers comprehensive data distribution notes, it requires careful resource limit configuration to avoid overloading production environments.