# Generate Mdl

Generate a Wren MDL project by exploring a database with available tools (SQLAlchemy...

- Repository: https://github.com/Canner/WrenAI (18031 stars)
- Category: Data and ML
- License: Apache-2.0
- Last updated: 2026-10-30
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add Canner/WrenAI --skill generate-mdl -g -a claude-code -y`
Codex: `npx skills add Canner/WrenAI --skill generate-mdl -g -a codex -y`
Cursor: `npx skills add Canner/WrenAI --skill generate-mdl -g -a cursor -y`
Gemini CLI: `npx skills add Canner/WrenAI --skill generate-mdl -g -a gemini-cli -y`

## Description

Generate a Wren MDL project by exploring a database with available tools (SQLAlchemy, database drivers, MCP connectors, or raw SQL). Guides agents through schema discovery, type normalization, and MDL YAML generation using the wren CLI. Use when: user wants to create or set up a new MDL, onboard a new data source, or scaffold a project from an existing database.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Generate Wren MDL, CLI Agent Workflow

Builds an MDL project by discovering database schema and converting it
into Wren's YAML project format. The agent uses whatever database tools
are available in its environment for introspection; the wren CLI handles
type normalization, validation, and build.

For memory and query workflows after setup, run `wren skills get usage`.

## Prerequisites

- `wren` CLI installed (`pip install "wrenai[<datasource>]"`)
- A working database connection (credentials available to the agent)
- A connection profile (set up via `wren profile add`) or connection info ready

## Alternative, import from an OpenMetadata catalog

If the user's team already catalogs this database in OpenMetadata, import
from the catalog instead of introspecting the live database. The import
carries curated table/column descriptions, tags, owners, and foreign-key
constraints (as `relationships.yml`), so the join-inference work in Phase 4
is mostly done:

```bash
wren context import openmetadata --host <om_url> --token <om_token> \
  --service <om_service> --database <db> --schema <schema> --dry-run
wren context import openmetadata --host <om_url> --token <om_token> \
  --service <om_service> --database <db> --schema <schema>
```

Ask the user for the OpenMetadata URL, a read-only bot or personal access
token, and the service name as it appears in OpenMetadata. `--table`
(repeatable) narrows the import. Without `--force` the command only adds
files that do not exist and lists the collisions it left untouched; `--force`
regenerates from OpenMetadata and discards local edits to generated files, confirm with the user before using it. Relationships come from foreign keys
only; review whether additional joins are needed (Phase 4), then bind a
profile and finish with Phase 5 (`wren context validate` → `wren context build`).

## Phase 0, Detect existing project

**Goal:** If the current directory is already inside a wren project, let the user decide how to proceed.

The rest: https://github.com/Canner/WrenAI/blob/HEAD/core/wren/src/wren/skills_content/generate-mdl/SKILL.md
