generate-mdl
ما الذي تفعله
تُرشد هذه المهارة بناء مشروع Wren MDL من قاعدة بيانات موجودة، بما في ذلك اكتشاف المخطط وتنظيف الأنواع وتوليد ملفات YAML باستخدام سطر أوامر wren. وهي للمحللين الذين يريدون إعداد طبقة دلالية فوق قاعدة بيانات يستخدمونها بالفعل.
متى تستخدمها
- ✓عندما تريد إعداد مشروع Wren جديد لقاعدة بيانات موجودة لديك.
- ✓عندما يفهرس فريقك قاعدة البيانات في OpenMetadata وتريد استيرادها.
- ✓عندما تحتاج إلى إنشاء هيكل مشروع دلالي من جداول موجودة وعلاقاتها.
رابط المهارة
https://github.com/Canner/WrenAI/blob/main/core/wren/src/wren/skills_content/generate-mdl/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“أنشئ مشروع Wren من قاعدة بيانات المبيعات في Postgres لدينا، مع استنتاج علاقات الجداول والتحقق من أن المشروع يُبنى.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
يقرأ وكيلك المخطط بأدوات قاعدة البيانات، ويوحّد أنواع البيانات، ويولّد ملفات المشروع بأداة wren، ثم يتحقق من البناء.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
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
wrenCLI 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:
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.
Check whether wren_project.yml exists in the current working directory
(or any parent up to the repository root). If found:
- Tell the user that an existing wren project was detected and show its path.
- Ask:
- Reset — wipe the existing project (
models/,views/,relationships.yml,knowledge/, and rebuildwren_project.yml) and regenerate from scratch in the same directory. - New path — keep the existing project untouched and choose a
different directory for the new project. Ask the user for the new path,
then
wren context init --path <new_path>and continue from Phase 1 using that path.
- Reset — wipe the existing project (
If no existing project is detected, proceed directly to Phase 1.
Phase 1 — Establish connection and scope
Goal: Confirm the agent can reach the database and agree on scope with the user.
Verify connectivity using whichever tool is available:
- If SQLAlchemy:
engine.connect()test - If database driver: simple query like
SELECT 1 - If wren profile exists:
wren profile debugto check config - If raw SQL via wren:
wren --sql "SELECT 1"(requires profile or connection file)
- If SQLAlchemy:
Ask the user:
- Which schema(s) or dataset(s) to include (skip if only one exists)
- Whether to include all tables or a subset
- The datasource type for wren (e.g.,
postgres(including Aurora),mysql(including Aurora),bigquery,snowflake) — needed for type normalization dialect
Phase 2 — Discover schema
Goal: Collect table names, column names, column types, and constraints.
Use whatever introspection method is available. Here are common approaches ranked by convenience:
Option A: SQLAlchemy (recommended if available)
from sqlalchemy import create_engine, inspect
engine = create_engine(connection_url)
inspector = inspect(engine)
tables = inspector.get_table_names(schema="public")
for table in tables:
columns = inspector.get_columns(table, schema="public")
# columns → [{"name": "id", "type": INTEGER(), "nullable": False, ...}]
pk = inspector.get_pk_constraint(table, schema="public")
# pk → {"constrained_columns": ["id"], "name": "orders_pkey"}
fks = inspector.get_foreign_keys(table, schema="public")
# fks → [{"constrained_columns": ["customer_id"],
# "referred_table": "customers",
# "referred_columns": ["id"]}]
Option B: Database-specific driver
- psycopg / asyncpg (Postgres): Query `informatio
الأسئلة الشائعة
ما MDL؟
هي صيغة النموذج الدلالي التي يستخدمها Wren لوصف الجداول والأعمدة والعلاقات بملفات YAML بسيطة.
هل يمكن الاستيراد من فهرس بيانات؟
نعم. تصف المهارة الاستيراد من OpenMetadata، الذي ينقل الأوصاف والمفاتيح الخارجية إلى المشروع.
هل تحتاج إلى بيانات اعتماد قاعدة البيانات؟
نعم. يحتاج وكيلك إلى اتصال عامل وبيانات اعتماد متوفرة في بيئته لقراءة المخطط.
التفاصيل
الوصف الأصلي من المؤلف
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.
repo: Canner/WrenAI
الشعبية
- نجوم GitHub
- 18k
- الترتيب
- #10727
- الترخيص
- —
- آخر تحديث
- 2/11/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
dlt-connector
18kيساعد وكيلك على تحميل بيانات أدوات SaaS مثل HubSpot أو Stripe إلى ملف DuckDB محلي، جاهزة لتحليل SQL عبر Wren.
enrich-context
18kيساعد وكيلك على إضافة المعنى التجاري إلى مشروع بيانات Wren، مثل الوحدات وقيم التعداد والمرادفات والمقاييس القياسية.
genbi
18kيساعد وكيلك على تحويل مشروع Wren للبيانات إلى لوحة معلومات قابلة للمشاركة في المتصفح، ونشرها في حساب الاستضافة الخاص بالمستخدم.
onboarding
18kيساعد وكيلك على إعداد محرك Wren من الصفر: فحص البيئة وإنشاء مشروع وربط قاعدة بيانات وتشغيل أول استعلام.
مهارات مشابهة
discrawl
394kيتيح لوكيلك البحث في أرشيف محلي محفوظ لرسائل Discord وتلخيصه، والتحقق من مدى حداثته، وقراءة الرسائل المباشرة.
clickhouse-io
280kيساعد وكيلك على تحسين الاستعلامات والمخططات في ClickHouse وتطبيق أفضل ممارسات التحليل عالي الأداء، ويفيد عندما تكون الاستعلامات التحليلية بطيئة.
scientific-db-pubmed-database
280kيساعد وكيلك على البحث عن المقالات العلمية في المجال الطبي الحيوي. مفيد للبحوث التي تحتاج إلى معلومات طبية محددة.