Skip to content
Back to skills

Query Engine

ASecurity

"Guide Wren governed SQL and cube queries, dry-plan and dry-run

  • 247 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 9, 2026
toolspythongobashsqlrailsapidatabase

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 8 files and shows the line behind each finding

Scanned September 9, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill query-engine --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Query Engine?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Query Engine
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-query-engine-arex-skill/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-query-engine-arex-skill)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: query-engine
description: "Guide Wren governed SQL and cube queries, dry-plan and dry-run
  diagnostics, connectors, SQL policy, and the WrenEngine Python API."
disable-model-invocation: true
metadata:
  disco-role: operating
license: NOASSERTION
---

# Wren Query Engine

Use this route for a business-data query, a planning error, a cube query, a
connector decision, or Python code that embeds Wren's semantic engine.

## Safe Query Order

1. Confirm the project and compiled target:
   ```bash
   wren context show
   test -f target/mdl.json
   ```
2. Fetch schema/business context through the memory-knowledge route when
   available; write SQL against MDL model/view names, not raw tables.
3. For a complex query, inspect generated SQL before execution:
   ```bash
   wren dry-plan --sql 'SELECT ...'
   ```
4. Execute only after the plan and profile are correct:
   ```bash
   wren query --sql 'SELECT ...' --output table --limit 100
   ```
5. Use `wren dry-run` for a live database validation with no returned rows.
6. Store a successful, meaningful NL→SQL pair through the memory route only
   after it is accepted as correct.

## Choose the Interface

- `wren --sql` is the short form of `wren query`.
- `wren dry-plan` is a semantic/dialect plan and does not need a live query.
- `wren dry-run` checks the planned SQL against the live datasource.
- `wren cube query` is preferred for a covered measure/dimension/time query.
- `WrenEngine` returns a PyArrow table to Python callers.
- For a new or unfamiliar query shape, inspect the resulting plan before an
  execution path that could access a costly or production datasource.

## Fast Error Recovery

- **Model/column error in a dry plan**: read project context or memory first;
  correct one semantic name/relationship issue, then rerun the plan.
- **Plan succeeds but a query fails**: preserve the emitted dialect SQL and
  check the selected profile, connector extra, permissions, and database error.
- **Aggregation request**: ask whether a cube already covers it before writing
  raw `GROUP BY` SQL.
- **Local file/table issue**: confirm the model physical reference and the
  connector's file/catalog conventions; do not change semantic model names just
  to hide an attachment mismatch.

## Route Elsewhere

- Project/profile/MDL authoring: `../cli-projects/SKILL.md`.
- Memory/knowledge context: `../memory-knowledge/SKILL.md`.
- Framework agent tools: `../sdk-integrations/SKILL.md`.

## References and Helpers

- Read `references/query-workflows.md` for query and error-recovery order.
- Read `references/python-api.md` for verified Python signatures and low-level
  planning behavior.
- Read `references/connectors.md` before selecting optional datasource packages.
- Read `references/cubes.md` for structured aggregation syntax.
- Read `references/troubleshooting.md` when the plan or execution fails.
- Run `scripts/check_wren_environment.py` for package/CLI checks and
  `scripts/dry_plan_smoke.py --mdl <path> --datasource <name> --sql '...'` for
  a no-database planning smoke.

## Guardrails

- A successful dry-plan does not prove database permissions, connectivity, or
  query cost.
- A CPU import does not verify a remote connector or cloud credential.
- Respect configured `strict_mode` and `denied_functions`; do not bypass them
  by changing query text or using unmodeled tables.

Files in this skill

  • SKILL.md3.3 KB
  • references/connectors.md1.6 KB
  • references/cubes.md1.7 KB
  • references/python-api.md1.9 KB
  • references/query-workflows.md2.3 KB
  • references/troubleshooting.md1.5 KB
  • scripts/check_wren_environment.py1.6 KB
  • scripts/dry_plan_smoke.py1.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.