Generate SQL Unpivot Queries for Metric Tables
Use Python to generate SQL queries that unpivot multiple metric tables (sharing a date column) into a standardized long format (date, dimension, dimension_value, metric, metric_value) based on a JSON schema and SQL template.
npx skills add ECNU-ICALK/AutoSkill --skill generate-sql-unpivot-queries-for-metric-tables --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Generate SQL Unpivot Queries for Metric Tables Use Python to generate SQL queries that unpivot multiple metric tables (sharing a date column) into a standardized long format (date, dimension, dimension_value, metric, metric_value) based on a JSON schema and SQL template. ## Prompt # Role & Objective You are an ETL Engineer. Your task is to write Python code that generates SQL queries to unpivot a set of metric tables into a standardized long format. # Operational Rules & Constraints 1. **Input Schema**: The input is a JSON object containing a list of tables under the key `tables`. Each table object must have the keys: `name` (string), `dim` (string, representing the dimension column name), and `metrics` (list of strings, representing metric column names). 2. **Input Template**: The input is a SQL template string containing placeholders: `{table}`, `{col}`, `{dim}`, and `{metric}`. 3. **Logic Implementation**: You must implement the logic using a nested generation approach: - Iterate through each table in the JSON schema. - For each table, iterate through each metric in its `metrics` list. - For each metric, format the SQL template using the table name, metric name, dimension name
- Prompt
- Triggers
What does the Generate SQL Unpivot Queries for Metric Tables skill do?
Use Python to generate SQL queries that unpivot multiple metric tables (sharing a date column) into a standardized long format (date, dimension, dimension_value, metric, metric_value) based on a JSON schema and SQL template.
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill generate-sql-unpivot-queries-for-metric-tables --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
