wren-sql

Translate user requests into MDL-aware SQL for Wren semantic models.

663|199|Updated May 9, 2022
One-click install
npx skills add https://github.com/Canner/wren-engine --skill wren-sql
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wren-sql
Source: https://github.com/Canner/wren-engine/tree/main/skills/wren-sql
Command: npx skills add https://github.com/Canner/wren-engine --skill wren-sql

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Wren-sql helps data teams and engineers generate and correct SQL against the Wren semantic MDL layer, reducing manual translation from business models to queries and preventing invalid references to raw tables.

Core Features & Use Cases

  • Generate MDL-compliant SQL from high-level requests and automatically apply MDL constraints.
  • Diagnose and correct SQL errors using the built-in rules and reference materials.
  • Use cases include building dashboards, ad-hoc analysis, and data exploration across MDL models.

Quick Start

Write a query against the MDL Sales model to fetch total_sales for region = 'EMEA' in the most recent quarter.

Frequently Asked Questions about wren-sql

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

FAQPage Schema
How do I generate SQL queries against a semantic model instead of raw database tables?

To generate SQL queries against a semantic model, you translate high-level requests into MDL-aware SQL. This approach operates on Wren's semantic MDL layer rather than raw tables, automatically applying model constraints and enforcing identifier quoting to prevent invalid references.

Why does my SQL query fail when referencing raw tables in an MDL data modeling environment?

Your SQL query fails because an MDL data modeling environment requires referencing semantic models rather than raw database tables. The system enforces core SQL constraints and validates queries against Wren's MDL definitions, rejecting direct raw table references.

Can I use natural language to build dashboards and explore data across multiple data sources?

Yes, you can use natural language to build dashboards and explore data across multiple data sources. The system translates high-level requests into MDL-aware SQL, unifying exploration across disparate sources through the Wren semantic layer.

How do I diagnose and correct SQL errors related to dialect-specific quirks and datetime types?

To diagnose and correct SQL errors related to dialect-specific quirks and datetime types, the system applies built-in rules and reference materials. It validates constraints, checks precise identifier quoting, and references included topics to resolve issues.

What is the best way to translate business model requirements into valid SQL for ad-hoc analysis?

The best way to translate business model requirements into valid SQL for ad-hoc analysis is generating MDL-compliant SQL. This method automatically applies MDL constraints, ensuring queries align with the Wren semantic layer and reducing manual translation effort.