[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-dbt-labs-answering-natural-language-questions-with-dbt":3,"mdc-ex5l7r-key":38,"related-org-dbt-labs-answering-natural-language-questions-with-dbt":1644,"related-repo-dbt-labs-answering-natural-language-questions-with-dbt":1801},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":27,"repoUrl":28,"updatedAt":29,"license":30,"forks":31,"topics":32,"repo":33,"sourceUrl":36,"mdContent":37},"answering-natural-language-questions-with-dbt","answer business questions using dbt Semantic Layer","Writes and executes SQL queries against the data warehouse using dbt's Semantic Layer or ad-hoc SQL to answer business questions. Use when a user asks about analytics, metrics, KPIs, or data (e.g., \"What were total sales last quarter?\", \"Show me top customers by revenue\"). NOT for validating, testing, or building dbt models during development.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},"dbt-labs","dbt Labs","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fdbt-labs.png",[12,16,18,21,24],{"name":13,"slug":14,"type":15},"Data Analysis","data-analysis","tag",{"name":17,"slug":17,"type":15},"dbt",{"name":19,"slug":20,"type":15},"Analytics","analytics",{"name":22,"slug":23,"type":15},"SQL","sql",{"name":25,"slug":26,"type":15},"Metrics","metrics",623,"https:\u002F\u002Fgithub.com\u002Fdbt-labs\u002Fdbt-agent-skills","2026-04-06T18:09:07.651959",null,52,[],{"repoUrl":28,"stars":27,"forks":31,"topics":34,"description":35},[],"A curated collection of Agent Skills for working with dbt, to help AI agents understand and execute dbt workflows more effectively.","https:\u002F\u002Fgithub.com\u002Fdbt-labs\u002Fdbt-agent-skills\u002Ftree\u002FHEAD\u002Fskills\u002Fdbt\u002Fskills\u002Fanswering-natural-language-questions-with-dbt","---\nname: answering-natural-language-questions-with-dbt\ndescription: Writes and executes SQL queries against the data warehouse using dbt's Semantic Layer or ad-hoc SQL to answer business questions. Use when a user asks about analytics, metrics, KPIs, or data (e.g., \"What were total sales last quarter?\", \"Show me top customers by revenue\"). NOT for validating, testing, or building dbt models during development.\nuser-invocable: false\nmetadata:\n  author: dbt-labs\n---\n\n# Answering Natural Language Questions with dbt\n\n## Overview\n\nAnswer data questions using the best available method: semantic layer first, then SQL modification, then model discovery, then manifest analysis. Always exhaust options before saying \"cannot answer.\"\n\n**Use for:** Business questions from users that need data answers\n- \"What were total sales last month?\"\n- \"How many active customers do we have?\"\n- \"Show me revenue by region\"\n\n**Not for:**\n- Validating model logic during development\n- Testing dbt models or semantic layer definitions\n- Building or modifying dbt models\n- `dbt run`, `dbt test`, or `dbt build` workflows\n\n## Decision Flow\n\n```mermaid\nflowchart TD\n    start([Business question received])\n    check_sl{Semantic layer tools available?}\n    list_metrics[list_metrics]\n    metric_exists{Relevant metric exists?}\n    get_dims[get_dimensions]\n    sl_sufficient{SL can answer directly?}\n    query_metrics[query_metrics]\n    answer([Return answer])\n    try_compiled[get_metrics_compiled_sql\u003Cbr\u002F>Modify SQL, execute_sql]\n    check_discovery{Model discovery tools available?}\n    try_discovery[get_mart_models\u003Cbr\u002F>get_model_details\u003Cbr\u002F>Write SQL, execute]\n    check_manifest{In dbt project?}\n    try_manifest[Analyze manifest\u002Fcatalog\u003Cbr\u002F>Write SQL]\n    cannot([Cannot answer])\n    suggest{In dbt project?}\n    improvements[Suggest semantic layer changes]\n    done([Done])\n\n    start --> check_sl\n    check_sl -->|yes| list_metrics\n    check_sl -->|no| check_discovery\n    list_metrics --> metric_exists\n    metric_exists -->|yes| get_dims\n    metric_exists -->|no| check_discovery\n    get_dims --> sl_sufficient\n    sl_sufficient -->|yes| query_metrics\n    sl_sufficient -->|no| try_compiled\n    query_metrics --> answer\n    try_compiled -->|success| answer\n    try_compiled -->|fail| check_discovery\n    check_discovery -->|yes| try_discovery\n    check_discovery -->|no| check_manifest\n    try_discovery -->|success| answer\n    try_discovery -->|fail| check_manifest\n    check_manifest -->|yes| try_manifest\n    check_manifest -->|no| cannot\n    try_manifest -->|SQL ready| answer\n    answer --> suggest\n    cannot --> done\n    suggest -->|yes| improvements\n    suggest -->|no| done\n    improvements --> done\n```\n\n## Quick Reference\n\n| Priority | Condition | Approach | Tools |\n|----------|-----------|----------|-------|\n| 1 | Semantic layer active | Query metrics directly | `list_metrics`, `get_dimensions`, `query_metrics` |\n| 2 | SL active but minor modifications needed (missing dimension, custom filter, case when, different aggregation) | Modify compiled SQL | `get_metrics_compiled_sql`, then `execute_sql` |\n| 3 | No SL, discovery tools active | Explore models, write SQL | `get_mart_models`, `get_model_details`, then `show`\u002F`execute_sql` |\n| 4 | No MCP, in dbt project | Analyze artifacts, write SQL | Read `target\u002Fmanifest.json`, `target\u002Fcatalog.json` |\n\n## Approach 1: Semantic Layer Query\n\nWhen `list_metrics` and `query_metrics` are available:\n\n1. `list_metrics` - find relevant metric\n2. `get_dimensions` - verify required dimensions exist\n3. `query_metrics` - execute with appropriate filters\n\nIf semantic layer can't answer directly (missing dimension, need custom logic) → go to Approach 2.\n\n## Approach 2: Modified Compiled SQL\n\nWhen semantic layer has the metric but needs minor modifications:\n\n- Missing dimension (join + group by)\n- Custom filter not available as a dimension\n- Case when logic for custom categorization\n- Different aggregation than what's defined\n\n1. `get_metrics_compiled_sql` - get the SQL that would run (returns raw SQL, not Jinja)\n2. Modify SQL to add what's needed\n3. `execute_sql` to run the raw SQL\n4. **Always suggest** updating the semantic model if the modification would be reusable\n\n```sql\n-- Example: Adding sales_rep dimension\nWITH base AS (\n    -- ... compiled metric logic (already resolved to table names) ...\n)\nSELECT base.*, reps.sales_rep_name\nFROM base\nJOIN analytics.dim_sales_reps reps ON base.rep_id = reps.id\nGROUP BY ...\n\n-- Example: Custom filter\nSELECT * FROM (compiled_metric_sql) WHERE region = 'EMEA'\n\n-- Example: Case when categorization\nSELECT\n    CASE WHEN amount > 1000 THEN 'large' ELSE 'small' END as deal_size,\n    SUM(amount)\nFROM (compiled_metric_sql)\nGROUP BY 1\n```\n\n**Note:** The compiled SQL contains resolved table names, not `{{ ref() }}`. Work with the raw SQL as returned.\n\n## Approach 3: Model Discovery\n\nWhen no semantic layer but `get_all_models`\u002F`get_model_details` available:\n\n1. `get_mart_models` - start with marts, not staging\n2. `get_model_details` for relevant models - understand schema\n3. Write SQL using `{{ ref('model_name') }}`\n4. `show --inline \"...\"` or `execute_sql`\n\n**Prefer marts over staging** - marts have business logic applied.\n\n## Approach 4: Manifest\u002FCatalog Analysis\n\nWhen in a dbt project but no MCP server:\n\n1. Check for `target\u002Fmanifest.json` and `target\u002Fcatalog.json`\n2. **Filter before reading** - these files can be large\n\n```bash\n# Find mart models in manifest\njq '.nodes | to_entries | map(select(.key | startswith(\"model.\") and contains(\"mart\"))) | .[].value | {name: .name, schema: .schema, columns: .columns}' target\u002Fmanifest.json\n\n# Get column info from catalog\njq '.nodes[\"model.project_name.model_name\"].columns' target\u002Fcatalog.json\n```\n\n3. Write SQL based on discovered schema\n4. Explain: \"This SQL should run in your warehouse. I cannot execute it without database access.\"\n\n## Suggesting Improvements\n\n**When in a dbt project**, suggest semantic layer changes after answering (or when cannot answer):\n\n| Gap | Suggestion |\n|-----|------------|\n| Metric doesn't exist | \"Add a metric definition to your semantic model\" |\n| Dimension missing | \"Add `dimension_name` to the dimensions list in the semantic model\" |\n| No semantic layer | \"Consider adding a semantic layer for this data\" |\n\n**Stay at semantic layer level.** Do NOT suggest:\n- Database schema changes\n- ETL pipeline modifications\n- \"Ask your data engineering team to...\"\n\n## Rationalizations to Resist\n\n| You're Thinking... | Reality |\n|--------------------|---------|\n| \"Semantic layer doesn't support this exact query\" | Get compiled SQL and modify it (Approach 2) |\n| \"No MCP tools, can't help\" | Check for manifest\u002Fcatalog locally |\n| \"User needs this quickly, skip the systematic check\" | Systematic approach IS the fastest path |\n| \"Just write SQL, it's faster\" | Semantic layer exists for a reason - use it first |\n| \"The dimension doesn't exist in the data\" | Maybe it exists but not in semantic layer config |\n\n## Red Flags - STOP\n\n- Writing SQL without checking if semantic layer can answer\n- Saying \"cannot answer\" without trying all 4 approaches\n- Suggesting database-level fixes for semantic layer gaps\n- Reading entire manifest.json without filtering\n- Using staging models when mart models exist\n- Using this to validate model correctness rather than answer business questions\n\n## Common Mistakes\n\n| Mistake | Fix |\n|---------|-----|\n| Giving up when SL can't answer directly | Get compiled SQL and modify it |\n| Querying staging models | Use `get_mart_models` first |\n| Reading full manifest.json | Use jq to filter |\n| Suggesting ETL changes | Keep suggestions at semantic layer |\n| Not checking tool availability | List available tools before choosing approach |\n",{"data":39,"body":42},{"name":4,"description":6,"user-invocable":40,"metadata":41},false,{"author":8},{"type":43,"children":44},"root",[45,53,60,66,77,97,105,151,157,558,564,762,768,787,821,826,832,837,860,898,1048,1066,1072,1091,1141,1151,1157,1162,1191,1280,1293,1299,1309,1378,1388,1406,1412,1499,1505,1538,1544,1638],{"type":46,"tag":47,"props":48,"children":49},"element","h1",{"id":4},[50],{"type":51,"value":52},"text","Answering Natural Language Questions with dbt",{"type":46,"tag":54,"props":55,"children":57},"h2",{"id":56},"overview",[58],{"type":51,"value":59},"Overview",{"type":46,"tag":61,"props":62,"children":63},"p",{},[64],{"type":51,"value":65},"Answer data questions using the best available method: semantic layer first, then SQL modification, then model discovery, then manifest analysis. Always exhaust options before saying \"cannot answer.\"",{"type":46,"tag":61,"props":67,"children":68},{},[69,75],{"type":46,"tag":70,"props":71,"children":72},"strong",{},[73],{"type":51,"value":74},"Use for:",{"type":51,"value":76}," Business questions from users that need data answers",{"type":46,"tag":78,"props":79,"children":80},"ul",{},[81,87,92],{"type":46,"tag":82,"props":83,"children":84},"li",{},[85],{"type":51,"value":86},"\"What were total sales last month?\"",{"type":46,"tag":82,"props":88,"children":89},{},[90],{"type":51,"value":91},"\"How many active customers do we have?\"",{"type":46,"tag":82,"props":93,"children":94},{},[95],{"type":51,"value":96},"\"Show me revenue by region\"",{"type":46,"tag":61,"props":98,"children":99},{},[100],{"type":46,"tag":70,"props":101,"children":102},{},[103],{"type":51,"value":104},"Not for:",{"type":46,"tag":78,"props":106,"children":107},{},[108,113,118,123],{"type":46,"tag":82,"props":109,"children":110},{},[111],{"type":51,"value":112},"Validating model logic during development",{"type":46,"tag":82,"props":114,"children":115},{},[116],{"type":51,"value":117},"Testing dbt models or semantic layer definitions",{"type":46,"tag":82,"props":119,"children":120},{},[121],{"type":51,"value":122},"Building or modifying dbt models",{"type":46,"tag":82,"props":124,"children":125},{},[126,133,135,141,143,149],{"type":46,"tag":127,"props":128,"children":130},"code",{"className":129},[],[131],{"type":51,"value":132},"dbt run",{"type":51,"value":134},", ",{"type":46,"tag":127,"props":136,"children":138},{"className":137},[],[139],{"type":51,"value":140},"dbt test",{"type":51,"value":142},", or ",{"type":46,"tag":127,"props":144,"children":146},{"className":145},[],[147],{"type":51,"value":148},"dbt build",{"type":51,"value":150}," workflows",{"type":46,"tag":54,"props":152,"children":154},{"id":153},"decision-flow",[155],{"type":51,"value":156},"Decision Flow",{"type":46,"tag":158,"props":159,"children":164},"pre",{"className":160,"code":161,"language":162,"meta":163,"style":163},"language-mermaid shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","flowchart TD\n    start([Business question received])\n    check_sl{Semantic layer tools available?}\n    list_metrics[list_metrics]\n    metric_exists{Relevant metric exists?}\n    get_dims[get_dimensions]\n    sl_sufficient{SL can answer directly?}\n    query_metrics[query_metrics]\n    answer([Return answer])\n    try_compiled[get_metrics_compiled_sql\u003Cbr\u002F>Modify SQL, execute_sql]\n    check_discovery{Model discovery tools available?}\n    try_discovery[get_mart_models\u003Cbr\u002F>get_model_details\u003Cbr\u002F>Write SQL, execute]\n    check_manifest{In dbt project?}\n    try_manifest[Analyze manifest\u002Fcatalog\u003Cbr\u002F>Write SQL]\n    cannot([Cannot answer])\n    suggest{In dbt project?}\n    improvements[Suggest semantic layer changes]\n    done([Done])\n\n    start --> check_sl\n    check_sl -->|yes| list_metrics\n    check_sl -->|no| check_discovery\n    list_metrics --> metric_exists\n    metric_exists -->|yes| get_dims\n    metric_exists -->|no| check_discovery\n    get_dims --> sl_sufficient\n    sl_sufficient -->|yes| query_metrics\n    sl_sufficient -->|no| try_compiled\n    query_metrics --> answer\n    try_compiled -->|success| answer\n    try_compiled -->|fail| check_discovery\n    check_discovery -->|yes| try_discovery\n    check_discovery -->|no| check_manifest\n    try_discovery -->|success| answer\n    try_discovery -->|fail| check_manifest\n    check_manifest -->|yes| try_manifest\n    check_manifest -->|no| cannot\n    try_manifest -->|SQL ready| answer\n    answer --> suggest\n    cannot --> done\n    suggest -->|yes| improvements\n    suggest -->|no| done\n    improvements --> done\n","mermaid","",[165],{"type":46,"tag":127,"props":166,"children":167},{"__ignoreMap":163},[168,179,188,197,206,215,224,233,242,251,260,269,278,287,296,305,314,323,332,342,351,360,369,378,387,396,405,414,423,432,441,450,459,468,477,486,495,504,513,522,531,540,549],{"type":46,"tag":169,"props":170,"children":173},"span",{"class":171,"line":172},"line",1,[174],{"type":46,"tag":169,"props":175,"children":176},{},[177],{"type":51,"value":178},"flowchart TD\n",{"type":46,"tag":169,"props":180,"children":182},{"class":171,"line":181},2,[183],{"type":46,"tag":169,"props":184,"children":185},{},[186],{"type":51,"value":187},"    start([Business question received])\n",{"type":46,"tag":169,"props":189,"children":191},{"class":171,"line":190},3,[192],{"type":46,"tag":169,"props":193,"children":194},{},[195],{"type":51,"value":196},"    check_sl{Semantic layer tools available?}\n",{"type":46,"tag":169,"props":198,"children":200},{"class":171,"line":199},4,[201],{"type":46,"tag":169,"props":202,"children":203},{},[204],{"type":51,"value":205},"    list_metrics[list_metrics]\n",{"type":46,"tag":169,"props":207,"children":209},{"class":171,"line":208},5,[210],{"type":46,"tag":169,"props":211,"children":212},{},[213],{"type":51,"value":214},"    metric_exists{Relevant metric exists?}\n",{"type":46,"tag":169,"props":216,"children":218},{"class":171,"line":217},6,[219],{"type":46,"tag":169,"props":220,"children":221},{},[222],{"type":51,"value":223},"    get_dims[get_dimensions]\n",{"type":46,"tag":169,"props":225,"children":227},{"class":171,"line":226},7,[228],{"type":46,"tag":169,"props":229,"children":230},{},[231],{"type":51,"value":232},"    sl_sufficient{SL can answer directly?}\n",{"type":46,"tag":169,"props":234,"children":236},{"class":171,"line":235},8,[237],{"type":46,"tag":169,"props":238,"children":239},{},[240],{"type":51,"value":241},"    query_metrics[query_metrics]\n",{"type":46,"tag":169,"props":243,"children":245},{"class":171,"line":244},9,[246],{"type":46,"tag":169,"props":247,"children":248},{},[249],{"type":51,"value":250},"    answer([Return answer])\n",{"type":46,"tag":169,"props":252,"children":254},{"class":171,"line":253},10,[255],{"type":46,"tag":169,"props":256,"children":257},{},[258],{"type":51,"value":259},"    try_compiled[get_metrics_compiled_sql\u003Cbr\u002F>Modify SQL, execute_sql]\n",{"type":46,"tag":169,"props":261,"children":263},{"class":171,"line":262},11,[264],{"type":46,"tag":169,"props":265,"children":266},{},[267],{"type":51,"value":268},"    check_discovery{Model discovery tools available?}\n",{"type":46,"tag":169,"props":270,"children":272},{"class":171,"line":271},12,[273],{"type":46,"tag":169,"props":274,"children":275},{},[276],{"type":51,"value":277},"    try_discovery[get_mart_models\u003Cbr\u002F>get_model_details\u003Cbr\u002F>Write SQL, execute]\n",{"type":46,"tag":169,"props":279,"children":281},{"class":171,"line":280},13,[282],{"type":46,"tag":169,"props":283,"children":284},{},[285],{"type":51,"value":286},"    check_manifest{In dbt project?}\n",{"type":46,"tag":169,"props":288,"children":290},{"class":171,"line":289},14,[291],{"type":46,"tag":169,"props":292,"children":293},{},[294],{"type":51,"value":295},"    try_manifest[Analyze manifest\u002Fcatalog\u003Cbr\u002F>Write SQL]\n",{"type":46,"tag":169,"props":297,"children":299},{"class":171,"line":298},15,[300],{"type":46,"tag":169,"props":301,"children":302},{},[303],{"type":51,"value":304},"    cannot([Cannot answer])\n",{"type":46,"tag":169,"props":306,"children":308},{"class":171,"line":307},16,[309],{"type":46,"tag":169,"props":310,"children":311},{},[312],{"type":51,"value":313},"    suggest{In dbt project?}\n",{"type":46,"tag":169,"props":315,"children":317},{"class":171,"line":316},17,[318],{"type":46,"tag":169,"props":319,"children":320},{},[321],{"type":51,"value":322},"    improvements[Suggest semantic layer changes]\n",{"type":46,"tag":169,"props":324,"children":326},{"class":171,"line":325},18,[327],{"type":46,"tag":169,"props":328,"children":329},{},[330],{"type":51,"value":331},"    done([Done])\n",{"type":46,"tag":169,"props":333,"children":335},{"class":171,"line":334},19,[336],{"type":46,"tag":169,"props":337,"children":339},{"emptyLinePlaceholder":338},true,[340],{"type":51,"value":341},"\n",{"type":46,"tag":169,"props":343,"children":345},{"class":171,"line":344},20,[346],{"type":46,"tag":169,"props":347,"children":348},{},[349],{"type":51,"value":350},"    start --> check_sl\n",{"type":46,"tag":169,"props":352,"children":354},{"class":171,"line":353},21,[355],{"type":46,"tag":169,"props":356,"children":357},{},[358],{"type":51,"value":359},"    check_sl -->|yes| list_metrics\n",{"type":46,"tag":169,"props":361,"children":363},{"class":171,"line":362},22,[364],{"type":46,"tag":169,"props":365,"children":366},{},[367],{"type":51,"value":368},"    check_sl -->|no| check_discovery\n",{"type":46,"tag":169,"props":370,"children":372},{"class":171,"line":371},23,[373],{"type":46,"tag":169,"props":374,"children":375},{},[376],{"type":51,"value":377},"    list_metrics --> metric_exists\n",{"type":46,"tag":169,"props":379,"children":381},{"class":171,"line":380},24,[382],{"type":46,"tag":169,"props":383,"children":384},{},[385],{"type":51,"value":386},"    metric_exists -->|yes| get_dims\n",{"type":46,"tag":169,"props":388,"children":390},{"class":171,"line":389},25,[391],{"type":46,"tag":169,"props":392,"children":393},{},[394],{"type":51,"value":395},"    metric_exists -->|no| check_discovery\n",{"type":46,"tag":169,"props":397,"children":399},{"class":171,"line":398},26,[400],{"type":46,"tag":169,"props":401,"children":402},{},[403],{"type":51,"value":404},"    get_dims --> sl_sufficient\n",{"type":46,"tag":169,"props":406,"children":408},{"class":171,"line":407},27,[409],{"type":46,"tag":169,"props":410,"children":411},{},[412],{"type":51,"value":413},"    sl_sufficient -->|yes| query_metrics\n",{"type":46,"tag":169,"props":415,"children":417},{"class":171,"line":416},28,[418],{"type":46,"tag":169,"props":419,"children":420},{},[421],{"type":51,"value":422},"    sl_sufficient -->|no| try_compiled\n",{"type":46,"tag":169,"props":424,"children":426},{"class":171,"line":425},29,[427],{"type":46,"tag":169,"props":428,"children":429},{},[430],{"type":51,"value":431},"    query_metrics --> answer\n",{"type":46,"tag":169,"props":433,"children":435},{"class":171,"line":434},30,[436],{"type":46,"tag":169,"props":437,"children":438},{},[439],{"type":51,"value":440},"    try_compiled -->|success| answer\n",{"type":46,"tag":169,"props":442,"children":444},{"class":171,"line":443},31,[445],{"type":46,"tag":169,"props":446,"children":447},{},[448],{"type":51,"value":449},"    try_compiled -->|fail| check_discovery\n",{"type":46,"tag":169,"props":451,"children":453},{"class":171,"line":452},32,[454],{"type":46,"tag":169,"props":455,"children":456},{},[457],{"type":51,"value":458},"    check_discovery -->|yes| try_discovery\n",{"type":46,"tag":169,"props":460,"children":462},{"class":171,"line":461},33,[463],{"type":46,"tag":169,"props":464,"children":465},{},[466],{"type":51,"value":467},"    check_discovery -->|no| check_manifest\n",{"type":46,"tag":169,"props":469,"children":471},{"class":171,"line":470},34,[472],{"type":46,"tag":169,"props":473,"children":474},{},[475],{"type":51,"value":476},"    try_discovery -->|success| answer\n",{"type":46,"tag":169,"props":478,"children":480},{"class":171,"line":479},35,[481],{"type":46,"tag":169,"props":482,"children":483},{},[484],{"type":51,"value":485},"    try_discovery -->|fail| check_manifest\n",{"type":46,"tag":169,"props":487,"children":489},{"class":171,"line":488},36,[490],{"type":46,"tag":169,"props":491,"children":492},{},[493],{"type":51,"value":494},"    check_manifest -->|yes| try_manifest\n",{"type":46,"tag":169,"props":496,"children":498},{"class":171,"line":497},37,[499],{"type":46,"tag":169,"props":500,"children":501},{},[502],{"type":51,"value":503},"    check_manifest -->|no| cannot\n",{"type":46,"tag":169,"props":505,"children":507},{"class":171,"line":506},38,[508],{"type":46,"tag":169,"props":509,"children":510},{},[511],{"type":51,"value":512},"    try_manifest -->|SQL ready| answer\n",{"type":46,"tag":169,"props":514,"children":516},{"class":171,"line":515},39,[517],{"type":46,"tag":169,"props":518,"children":519},{},[520],{"type":51,"value":521},"    answer --> suggest\n",{"type":46,"tag":169,"props":523,"children":525},{"class":171,"line":524},40,[526],{"type":46,"tag":169,"props":527,"children":528},{},[529],{"type":51,"value":530},"    cannot --> done\n",{"type":46,"tag":169,"props":532,"children":534},{"class":171,"line":533},41,[535],{"type":46,"tag":169,"props":536,"children":537},{},[538],{"type":51,"value":539},"    suggest -->|yes| improvements\n",{"type":46,"tag":169,"props":541,"children":543},{"class":171,"line":542},42,[544],{"type":46,"tag":169,"props":545,"children":546},{},[547],{"type":51,"value":548},"    suggest -->|no| done\n",{"type":46,"tag":169,"props":550,"children":552},{"class":171,"line":551},43,[553],{"type":46,"tag":169,"props":554,"children":555},{},[556],{"type":51,"value":557},"    improvements --> done\n",{"type":46,"tag":54,"props":559,"children":561},{"id":560},"quick-reference",[562],{"type":51,"value":563},"Quick Reference",{"type":46,"tag":565,"props":566,"children":567},"table",{},[568,597],{"type":46,"tag":569,"props":570,"children":571},"thead",{},[572],{"type":46,"tag":573,"props":574,"children":575},"tr",{},[576,582,587,592],{"type":46,"tag":577,"props":578,"children":579},"th",{},[580],{"type":51,"value":581},"Priority",{"type":46,"tag":577,"props":583,"children":584},{},[585],{"type":51,"value":586},"Condition",{"type":46,"tag":577,"props":588,"children":589},{},[590],{"type":51,"value":591},"Approach",{"type":46,"tag":577,"props":593,"children":594},{},[595],{"type":51,"value":596},"Tools",{"type":46,"tag":598,"props":599,"children":600},"tbody",{},[601,643,678,726],{"type":46,"tag":573,"props":602,"children":603},{},[604,610,615,620],{"type":46,"tag":605,"props":606,"children":607},"td",{},[608],{"type":51,"value":609},"1",{"type":46,"tag":605,"props":611,"children":612},{},[613],{"type":51,"value":614},"Semantic layer active",{"type":46,"tag":605,"props":616,"children":617},{},[618],{"type":51,"value":619},"Query metrics directly",{"type":46,"tag":605,"props":621,"children":622},{},[623,629,630,636,637],{"type":46,"tag":127,"props":624,"children":626},{"className":625},[],[627],{"type":51,"value":628},"list_metrics",{"type":51,"value":134},{"type":46,"tag":127,"props":631,"children":633},{"className":632},[],[634],{"type":51,"value":635},"get_dimensions",{"type":51,"value":134},{"type":46,"tag":127,"props":638,"children":640},{"className":639},[],[641],{"type":51,"value":642},"query_metrics",{"type":46,"tag":573,"props":644,"children":645},{},[646,651,656,661],{"type":46,"tag":605,"props":647,"children":648},{},[649],{"type":51,"value":650},"2",{"type":46,"tag":605,"props":652,"children":653},{},[654],{"type":51,"value":655},"SL active but minor modifications needed (missing dimension, custom filter, case when, different aggregation)",{"type":46,"tag":605,"props":657,"children":658},{},[659],{"type":51,"value":660},"Modify compiled SQL",{"type":46,"tag":605,"props":662,"children":663},{},[664,670,672],{"type":46,"tag":127,"props":665,"children":667},{"className":666},[],[668],{"type":51,"value":669},"get_metrics_compiled_sql",{"type":51,"value":671},", then ",{"type":46,"tag":127,"props":673,"children":675},{"className":674},[],[676],{"type":51,"value":677},"execute_sql",{"type":46,"tag":573,"props":679,"children":680},{},[681,686,691,696],{"type":46,"tag":605,"props":682,"children":683},{},[684],{"type":51,"value":685},"3",{"type":46,"tag":605,"props":687,"children":688},{},[689],{"type":51,"value":690},"No SL, discovery tools active",{"type":46,"tag":605,"props":692,"children":693},{},[694],{"type":51,"value":695},"Explore models, write SQL",{"type":46,"tag":605,"props":697,"children":698},{},[699,705,706,712,713,719,721],{"type":46,"tag":127,"props":700,"children":702},{"className":701},[],[703],{"type":51,"value":704},"get_mart_models",{"type":51,"value":134},{"type":46,"tag":127,"props":707,"children":709},{"className":708},[],[710],{"type":51,"value":711},"get_model_details",{"type":51,"value":671},{"type":46,"tag":127,"props":714,"children":716},{"className":715},[],[717],{"type":51,"value":718},"show",{"type":51,"value":720},"\u002F",{"type":46,"tag":127,"props":722,"children":724},{"className":723},[],[725],{"type":51,"value":677},{"type":46,"tag":573,"props":727,"children":728},{},[729,734,739,744],{"type":46,"tag":605,"props":730,"children":731},{},[732],{"type":51,"value":733},"4",{"type":46,"tag":605,"props":735,"children":736},{},[737],{"type":51,"value":738},"No MCP, in dbt project",{"type":46,"tag":605,"props":740,"children":741},{},[742],{"type":51,"value":743},"Analyze artifacts, write SQL",{"type":46,"tag":605,"props":745,"children":746},{},[747,749,755,756],{"type":51,"value":748},"Read ",{"type":46,"tag":127,"props":750,"children":752},{"className":751},[],[753],{"type":51,"value":754},"target\u002Fmanifest.json",{"type":51,"value":134},{"type":46,"tag":127,"props":757,"children":759},{"className":758},[],[760],{"type":51,"value":761},"target\u002Fcatalog.json",{"type":46,"tag":54,"props":763,"children":765},{"id":764},"approach-1-semantic-layer-query",[766],{"type":51,"value":767},"Approach 1: Semantic Layer Query",{"type":46,"tag":61,"props":769,"children":770},{},[771,773,778,780,785],{"type":51,"value":772},"When ",{"type":46,"tag":127,"props":774,"children":776},{"className":775},[],[777],{"type":51,"value":628},{"type":51,"value":779}," and ",{"type":46,"tag":127,"props":781,"children":783},{"className":782},[],[784],{"type":51,"value":642},{"type":51,"value":786}," are available:",{"type":46,"tag":788,"props":789,"children":790},"ol",{},[791,801,811],{"type":46,"tag":82,"props":792,"children":793},{},[794,799],{"type":46,"tag":127,"props":795,"children":797},{"className":796},[],[798],{"type":51,"value":628},{"type":51,"value":800}," - find relevant metric",{"type":46,"tag":82,"props":802,"children":803},{},[804,809],{"type":46,"tag":127,"props":805,"children":807},{"className":806},[],[808],{"type":51,"value":635},{"type":51,"value":810}," - verify required dimensions exist",{"type":46,"tag":82,"props":812,"children":813},{},[814,819],{"type":46,"tag":127,"props":815,"children":817},{"className":816},[],[818],{"type":51,"value":642},{"type":51,"value":820}," - execute with appropriate filters",{"type":46,"tag":61,"props":822,"children":823},{},[824],{"type":51,"value":825},"If semantic layer can't answer directly (missing dimension, need custom logic) → go to Approach 2.",{"type":46,"tag":54,"props":827,"children":829},{"id":828},"approach-2-modified-compiled-sql",[830],{"type":51,"value":831},"Approach 2: Modified Compiled SQL",{"type":46,"tag":61,"props":833,"children":834},{},[835],{"type":51,"value":836},"When semantic layer has the metric but needs minor modifications:",{"type":46,"tag":78,"props":838,"children":839},{},[840,845,850,855],{"type":46,"tag":82,"props":841,"children":842},{},[843],{"type":51,"value":844},"Missing dimension (join + group by)",{"type":46,"tag":82,"props":846,"children":847},{},[848],{"type":51,"value":849},"Custom filter not available as a dimension",{"type":46,"tag":82,"props":851,"children":852},{},[853],{"type":51,"value":854},"Case when logic for custom categorization",{"type":46,"tag":82,"props":856,"children":857},{},[858],{"type":51,"value":859},"Different aggregation than what's defined",{"type":46,"tag":788,"props":861,"children":862},{},[863,873,878,888],{"type":46,"tag":82,"props":864,"children":865},{},[866,871],{"type":46,"tag":127,"props":867,"children":869},{"className":868},[],[870],{"type":51,"value":669},{"type":51,"value":872}," - get the SQL that would run (returns raw SQL, not Jinja)",{"type":46,"tag":82,"props":874,"children":875},{},[876],{"type":51,"value":877},"Modify SQL to add what's needed",{"type":46,"tag":82,"props":879,"children":880},{},[881,886],{"type":46,"tag":127,"props":882,"children":884},{"className":883},[],[885],{"type":51,"value":677},{"type":51,"value":887}," to run the raw SQL",{"type":46,"tag":82,"props":889,"children":890},{},[891,896],{"type":46,"tag":70,"props":892,"children":893},{},[894],{"type":51,"value":895},"Always suggest",{"type":51,"value":897}," updating the semantic model if the modification would be reusable",{"type":46,"tag":158,"props":899,"children":902},{"className":900,"code":901,"language":23,"meta":163,"style":163},"language-sql shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","-- Example: Adding sales_rep dimension\nWITH base AS (\n    -- ... compiled metric logic (already resolved to table names) ...\n)\nSELECT base.*, reps.sales_rep_name\nFROM base\nJOIN analytics.dim_sales_reps reps ON base.rep_id = reps.id\nGROUP BY ...\n\n-- Example: Custom filter\nSELECT * FROM (compiled_metric_sql) WHERE region = 'EMEA'\n\n-- Example: Case when categorization\nSELECT\n    CASE WHEN amount > 1000 THEN 'large' ELSE 'small' END as deal_size,\n    SUM(amount)\nFROM (compiled_metric_sql)\nGROUP BY 1\n",[903],{"type":46,"tag":127,"props":904,"children":905},{"__ignoreMap":163},[906,914,922,930,938,946,954,962,970,977,985,993,1000,1008,1016,1024,1032,1040],{"type":46,"tag":169,"props":907,"children":908},{"class":171,"line":172},[909],{"type":46,"tag":169,"props":910,"children":911},{},[912],{"type":51,"value":913},"-- Example: Adding sales_rep dimension\n",{"type":46,"tag":169,"props":915,"children":916},{"class":171,"line":181},[917],{"type":46,"tag":169,"props":918,"children":919},{},[920],{"type":51,"value":921},"WITH base AS (\n",{"type":46,"tag":169,"props":923,"children":924},{"class":171,"line":190},[925],{"type":46,"tag":169,"props":926,"children":927},{},[928],{"type":51,"value":929},"    -- ... compiled metric logic (already resolved to table names) ...\n",{"type":46,"tag":169,"props":931,"children":932},{"class":171,"line":199},[933],{"type":46,"tag":169,"props":934,"children":935},{},[936],{"type":51,"value":937},")\n",{"type":46,"tag":169,"props":939,"children":940},{"class":171,"line":208},[941],{"type":46,"tag":169,"props":942,"children":943},{},[944],{"type":51,"value":945},"SELECT base.*, reps.sales_rep_name\n",{"type":46,"tag":169,"props":947,"children":948},{"class":171,"line":217},[949],{"type":46,"tag":169,"props":950,"children":951},{},[952],{"type":51,"value":953},"FROM base\n",{"type":46,"tag":169,"props":955,"children":956},{"class":171,"line":226},[957],{"type":46,"tag":169,"props":958,"children":959},{},[960],{"type":51,"value":961},"JOIN analytics.dim_sales_reps reps ON base.rep_id = reps.id\n",{"type":46,"tag":169,"props":963,"children":964},{"class":171,"line":235},[965],{"type":46,"tag":169,"props":966,"children":967},{},[968],{"type":51,"value":969},"GROUP BY ...\n",{"type":46,"tag":169,"props":971,"children":972},{"class":171,"line":244},[973],{"type":46,"tag":169,"props":974,"children":975},{"emptyLinePlaceholder":338},[976],{"type":51,"value":341},{"type":46,"tag":169,"props":978,"children":979},{"class":171,"line":253},[980],{"type":46,"tag":169,"props":981,"children":982},{},[983],{"type":51,"value":984},"-- Example: Custom filter\n",{"type":46,"tag":169,"props":986,"children":987},{"class":171,"line":262},[988],{"type":46,"tag":169,"props":989,"children":990},{},[991],{"type":51,"value":992},"SELECT * FROM (compiled_metric_sql) WHERE region = 'EMEA'\n",{"type":46,"tag":169,"props":994,"children":995},{"class":171,"line":271},[996],{"type":46,"tag":169,"props":997,"children":998},{"emptyLinePlaceholder":338},[999],{"type":51,"value":341},{"type":46,"tag":169,"props":1001,"children":1002},{"class":171,"line":280},[1003],{"type":46,"tag":169,"props":1004,"children":1005},{},[1006],{"type":51,"value":1007},"-- Example: Case when categorization\n",{"type":46,"tag":169,"props":1009,"children":1010},{"class":171,"line":289},[1011],{"type":46,"tag":169,"props":1012,"children":1013},{},[1014],{"type":51,"value":1015},"SELECT\n",{"type":46,"tag":169,"props":1017,"children":1018},{"class":171,"line":298},[1019],{"type":46,"tag":169,"props":1020,"children":1021},{},[1022],{"type":51,"value":1023},"    CASE WHEN amount > 1000 THEN 'large' ELSE 'small' END as deal_size,\n",{"type":46,"tag":169,"props":1025,"children":1026},{"class":171,"line":307},[1027],{"type":46,"tag":169,"props":1028,"children":1029},{},[1030],{"type":51,"value":1031},"    SUM(amount)\n",{"type":46,"tag":169,"props":1033,"children":1034},{"class":171,"line":316},[1035],{"type":46,"tag":169,"props":1036,"children":1037},{},[1038],{"type":51,"value":1039},"FROM (compiled_metric_sql)\n",{"type":46,"tag":169,"props":1041,"children":1042},{"class":171,"line":325},[1043],{"type":46,"tag":169,"props":1044,"children":1045},{},[1046],{"type":51,"value":1047},"GROUP BY 1\n",{"type":46,"tag":61,"props":1049,"children":1050},{},[1051,1056,1058,1064],{"type":46,"tag":70,"props":1052,"children":1053},{},[1054],{"type":51,"value":1055},"Note:",{"type":51,"value":1057}," The compiled SQL contains resolved table names, not ",{"type":46,"tag":127,"props":1059,"children":1061},{"className":1060},[],[1062],{"type":51,"value":1063},"{{ ref() }}",{"type":51,"value":1065},". Work with the raw SQL as returned.",{"type":46,"tag":54,"props":1067,"children":1069},{"id":1068},"approach-3-model-discovery",[1070],{"type":51,"value":1071},"Approach 3: Model Discovery",{"type":46,"tag":61,"props":1073,"children":1074},{},[1075,1077,1083,1084,1089],{"type":51,"value":1076},"When no semantic layer but ",{"type":46,"tag":127,"props":1078,"children":1080},{"className":1079},[],[1081],{"type":51,"value":1082},"get_all_models",{"type":51,"value":720},{"type":46,"tag":127,"props":1085,"children":1087},{"className":1086},[],[1088],{"type":51,"value":711},{"type":51,"value":1090}," available:",{"type":46,"tag":788,"props":1092,"children":1093},{},[1094,1104,1114,1125],{"type":46,"tag":82,"props":1095,"children":1096},{},[1097,1102],{"type":46,"tag":127,"props":1098,"children":1100},{"className":1099},[],[1101],{"type":51,"value":704},{"type":51,"value":1103}," - start with marts, not staging",{"type":46,"tag":82,"props":1105,"children":1106},{},[1107,1112],{"type":46,"tag":127,"props":1108,"children":1110},{"className":1109},[],[1111],{"type":51,"value":711},{"type":51,"value":1113}," for relevant models - understand schema",{"type":46,"tag":82,"props":1115,"children":1116},{},[1117,1119],{"type":51,"value":1118},"Write SQL using ",{"type":46,"tag":127,"props":1120,"children":1122},{"className":1121},[],[1123],{"type":51,"value":1124},"{{ ref('model_name') }}",{"type":46,"tag":82,"props":1126,"children":1127},{},[1128,1134,1136],{"type":46,"tag":127,"props":1129,"children":1131},{"className":1130},[],[1132],{"type":51,"value":1133},"show --inline \"...\"",{"type":51,"value":1135}," or ",{"type":46,"tag":127,"props":1137,"children":1139},{"className":1138},[],[1140],{"type":51,"value":677},{"type":46,"tag":61,"props":1142,"children":1143},{},[1144,1149],{"type":46,"tag":70,"props":1145,"children":1146},{},[1147],{"type":51,"value":1148},"Prefer marts over staging",{"type":51,"value":1150}," - marts have business logic applied.",{"type":46,"tag":54,"props":1152,"children":1154},{"id":1153},"approach-4-manifestcatalog-analysis",[1155],{"type":51,"value":1156},"Approach 4: Manifest\u002FCatalog Analysis",{"type":46,"tag":61,"props":1158,"children":1159},{},[1160],{"type":51,"value":1161},"When in a dbt project but no MCP server:",{"type":46,"tag":788,"props":1163,"children":1164},{},[1165,1181],{"type":46,"tag":82,"props":1166,"children":1167},{},[1168,1170,1175,1176],{"type":51,"value":1169},"Check for ",{"type":46,"tag":127,"props":1171,"children":1173},{"className":1172},[],[1174],{"type":51,"value":754},{"type":51,"value":779},{"type":46,"tag":127,"props":1177,"children":1179},{"className":1178},[],[1180],{"type":51,"value":761},{"type":46,"tag":82,"props":1182,"children":1183},{},[1184,1189],{"type":46,"tag":70,"props":1185,"children":1186},{},[1187],{"type":51,"value":1188},"Filter before reading",{"type":51,"value":1190}," - these files can be large",{"type":46,"tag":158,"props":1192,"children":1196},{"className":1193,"code":1194,"language":1195,"meta":163,"style":163},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","# Find mart models in manifest\njq '.nodes | to_entries | map(select(.key | startswith(\"model.\") and contains(\"mart\"))) | .[].value | {name: .name, schema: .schema, columns: .columns}' target\u002Fmanifest.json\n\n# Get column info from catalog\njq '.nodes[\"model.project_name.model_name\"].columns' target\u002Fcatalog.json\n","bash",[1197],{"type":46,"tag":127,"props":1198,"children":1199},{"__ignoreMap":163},[1200,1209,1240,1247,1255],{"type":46,"tag":169,"props":1201,"children":1202},{"class":171,"line":172},[1203],{"type":46,"tag":169,"props":1204,"children":1206},{"style":1205},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic",[1207],{"type":51,"value":1208},"# Find mart models in manifest\n",{"type":46,"tag":169,"props":1210,"children":1211},{"class":171,"line":181},[1212,1218,1224,1230,1235],{"type":46,"tag":169,"props":1213,"children":1215},{"style":1214},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[1216],{"type":51,"value":1217},"jq",{"type":46,"tag":169,"props":1219,"children":1221},{"style":1220},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[1222],{"type":51,"value":1223}," '",{"type":46,"tag":169,"props":1225,"children":1227},{"style":1226},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[1228],{"type":51,"value":1229},".nodes | to_entries | map(select(.key | startswith(\"model.\") and contains(\"mart\"))) | .[].value | {name: .name, schema: .schema, columns: .columns}",{"type":46,"tag":169,"props":1231,"children":1232},{"style":1220},[1233],{"type":51,"value":1234},"'",{"type":46,"tag":169,"props":1236,"children":1237},{"style":1226},[1238],{"type":51,"value":1239}," target\u002Fmanifest.json\n",{"type":46,"tag":169,"props":1241,"children":1242},{"class":171,"line":190},[1243],{"type":46,"tag":169,"props":1244,"children":1245},{"emptyLinePlaceholder":338},[1246],{"type":51,"value":341},{"type":46,"tag":169,"props":1248,"children":1249},{"class":171,"line":199},[1250],{"type":46,"tag":169,"props":1251,"children":1252},{"style":1205},[1253],{"type":51,"value":1254},"# Get column info from catalog\n",{"type":46,"tag":169,"props":1256,"children":1257},{"class":171,"line":208},[1258,1262,1266,1271,1275],{"type":46,"tag":169,"props":1259,"children":1260},{"style":1214},[1261],{"type":51,"value":1217},{"type":46,"tag":169,"props":1263,"children":1264},{"style":1220},[1265],{"type":51,"value":1223},{"type":46,"tag":169,"props":1267,"children":1268},{"style":1226},[1269],{"type":51,"value":1270},".nodes[\"model.project_name.model_name\"].columns",{"type":46,"tag":169,"props":1272,"children":1273},{"style":1220},[1274],{"type":51,"value":1234},{"type":46,"tag":169,"props":1276,"children":1277},{"style":1226},[1278],{"type":51,"value":1279}," target\u002Fcatalog.json\n",{"type":46,"tag":788,"props":1281,"children":1282},{"start":190},[1283,1288],{"type":46,"tag":82,"props":1284,"children":1285},{},[1286],{"type":51,"value":1287},"Write SQL based on discovered schema",{"type":46,"tag":82,"props":1289,"children":1290},{},[1291],{"type":51,"value":1292},"Explain: \"This SQL should run in your warehouse. I cannot execute it without database access.\"",{"type":46,"tag":54,"props":1294,"children":1296},{"id":1295},"suggesting-improvements",[1297],{"type":51,"value":1298},"Suggesting Improvements",{"type":46,"tag":61,"props":1300,"children":1301},{},[1302,1307],{"type":46,"tag":70,"props":1303,"children":1304},{},[1305],{"type":51,"value":1306},"When in a dbt project",{"type":51,"value":1308},", suggest semantic layer changes after answering (or when cannot answer):",{"type":46,"tag":565,"props":1310,"children":1311},{},[1312,1328],{"type":46,"tag":569,"props":1313,"children":1314},{},[1315],{"type":46,"tag":573,"props":1316,"children":1317},{},[1318,1323],{"type":46,"tag":577,"props":1319,"children":1320},{},[1321],{"type":51,"value":1322},"Gap",{"type":46,"tag":577,"props":1324,"children":1325},{},[1326],{"type":51,"value":1327},"Suggestion",{"type":46,"tag":598,"props":1329,"children":1330},{},[1331,1344,1365],{"type":46,"tag":573,"props":1332,"children":1333},{},[1334,1339],{"type":46,"tag":605,"props":1335,"children":1336},{},[1337],{"type":51,"value":1338},"Metric doesn't exist",{"type":46,"tag":605,"props":1340,"children":1341},{},[1342],{"type":51,"value":1343},"\"Add a metric definition to your semantic model\"",{"type":46,"tag":573,"props":1345,"children":1346},{},[1347,1352],{"type":46,"tag":605,"props":1348,"children":1349},{},[1350],{"type":51,"value":1351},"Dimension missing",{"type":46,"tag":605,"props":1353,"children":1354},{},[1355,1357,1363],{"type":51,"value":1356},"\"Add ",{"type":46,"tag":127,"props":1358,"children":1360},{"className":1359},[],[1361],{"type":51,"value":1362},"dimension_name",{"type":51,"value":1364}," to the dimensions list in the semantic model\"",{"type":46,"tag":573,"props":1366,"children":1367},{},[1368,1373],{"type":46,"tag":605,"props":1369,"children":1370},{},[1371],{"type":51,"value":1372},"No semantic layer",{"type":46,"tag":605,"props":1374,"children":1375},{},[1376],{"type":51,"value":1377},"\"Consider adding a semantic layer for this data\"",{"type":46,"tag":61,"props":1379,"children":1380},{},[1381,1386],{"type":46,"tag":70,"props":1382,"children":1383},{},[1384],{"type":51,"value":1385},"Stay at semantic layer level.",{"type":51,"value":1387}," Do NOT suggest:",{"type":46,"tag":78,"props":1389,"children":1390},{},[1391,1396,1401],{"type":46,"tag":82,"props":1392,"children":1393},{},[1394],{"type":51,"value":1395},"Database schema changes",{"type":46,"tag":82,"props":1397,"children":1398},{},[1399],{"type":51,"value":1400},"ETL pipeline modifications",{"type":46,"tag":82,"props":1402,"children":1403},{},[1404],{"type":51,"value":1405},"\"Ask your data engineering team to...\"",{"type":46,"tag":54,"props":1407,"children":1409},{"id":1408},"rationalizations-to-resist",[1410],{"type":51,"value":1411},"Rationalizations to Resist",{"type":46,"tag":565,"props":1413,"children":1414},{},[1415,1431],{"type":46,"tag":569,"props":1416,"children":1417},{},[1418],{"type":46,"tag":573,"props":1419,"children":1420},{},[1421,1426],{"type":46,"tag":577,"props":1422,"children":1423},{},[1424],{"type":51,"value":1425},"You're Thinking...",{"type":46,"tag":577,"props":1427,"children":1428},{},[1429],{"type":51,"value":1430},"Reality",{"type":46,"tag":598,"props":1432,"children":1433},{},[1434,1447,1460,1473,1486],{"type":46,"tag":573,"props":1435,"children":1436},{},[1437,1442],{"type":46,"tag":605,"props":1438,"children":1439},{},[1440],{"type":51,"value":1441},"\"Semantic layer doesn't support this exact query\"",{"type":46,"tag":605,"props":1443,"children":1444},{},[1445],{"type":51,"value":1446},"Get compiled SQL and modify it (Approach 2)",{"type":46,"tag":573,"props":1448,"children":1449},{},[1450,1455],{"type":46,"tag":605,"props":1451,"children":1452},{},[1453],{"type":51,"value":1454},"\"No MCP tools, can't help\"",{"type":46,"tag":605,"props":1456,"children":1457},{},[1458],{"type":51,"value":1459},"Check for manifest\u002Fcatalog locally",{"type":46,"tag":573,"props":1461,"children":1462},{},[1463,1468],{"type":46,"tag":605,"props":1464,"children":1465},{},[1466],{"type":51,"value":1467},"\"User needs this quickly, skip the systematic check\"",{"type":46,"tag":605,"props":1469,"children":1470},{},[1471],{"type":51,"value":1472},"Systematic approach IS the fastest path",{"type":46,"tag":573,"props":1474,"children":1475},{},[1476,1481],{"type":46,"tag":605,"props":1477,"children":1478},{},[1479],{"type":51,"value":1480},"\"Just write SQL, it's faster\"",{"type":46,"tag":605,"props":1482,"children":1483},{},[1484],{"type":51,"value":1485},"Semantic layer exists for a reason - use it first",{"type":46,"tag":573,"props":1487,"children":1488},{},[1489,1494],{"type":46,"tag":605,"props":1490,"children":1491},{},[1492],{"type":51,"value":1493},"\"The dimension doesn't exist in the data\"",{"type":46,"tag":605,"props":1495,"children":1496},{},[1497],{"type":51,"value":1498},"Maybe it exists but not in semantic layer config",{"type":46,"tag":54,"props":1500,"children":1502},{"id":1501},"red-flags-stop",[1503],{"type":51,"value":1504},"Red Flags - STOP",{"type":46,"tag":78,"props":1506,"children":1507},{},[1508,1513,1518,1523,1528,1533],{"type":46,"tag":82,"props":1509,"children":1510},{},[1511],{"type":51,"value":1512},"Writing SQL without checking if semantic layer can answer",{"type":46,"tag":82,"props":1514,"children":1515},{},[1516],{"type":51,"value":1517},"Saying \"cannot answer\" without trying all 4 approaches",{"type":46,"tag":82,"props":1519,"children":1520},{},[1521],{"type":51,"value":1522},"Suggesting database-level fixes for semantic layer gaps",{"type":46,"tag":82,"props":1524,"children":1525},{},[1526],{"type":51,"value":1527},"Reading entire manifest.json without filtering",{"type":46,"tag":82,"props":1529,"children":1530},{},[1531],{"type":51,"value":1532},"Using staging models when mart models exist",{"type":46,"tag":82,"props":1534,"children":1535},{},[1536],{"type":51,"value":1537},"Using this to validate model correctness rather than answer business questions",{"type":46,"tag":54,"props":1539,"children":1541},{"id":1540},"common-mistakes",[1542],{"type":51,"value":1543},"Common Mistakes",{"type":46,"tag":565,"props":1545,"children":1546},{},[1547,1563],{"type":46,"tag":569,"props":1548,"children":1549},{},[1550],{"type":46,"tag":573,"props":1551,"children":1552},{},[1553,1558],{"type":46,"tag":577,"props":1554,"children":1555},{},[1556],{"type":51,"value":1557},"Mistake",{"type":46,"tag":577,"props":1559,"children":1560},{},[1561],{"type":51,"value":1562},"Fix",{"type":46,"tag":598,"props":1564,"children":1565},{},[1566,1579,1599,1612,1625],{"type":46,"tag":573,"props":1567,"children":1568},{},[1569,1574],{"type":46,"tag":605,"props":1570,"children":1571},{},[1572],{"type":51,"value":1573},"Giving up when SL can't answer directly",{"type":46,"tag":605,"props":1575,"children":1576},{},[1577],{"type":51,"value":1578},"Get compiled SQL and modify it",{"type":46,"tag":573,"props":1580,"children":1581},{},[1582,1587],{"type":46,"tag":605,"props":1583,"children":1584},{},[1585],{"type":51,"value":1586},"Querying staging models",{"type":46,"tag":605,"props":1588,"children":1589},{},[1590,1592,1597],{"type":51,"value":1591},"Use ",{"type":46,"tag":127,"props":1593,"children":1595},{"className":1594},[],[1596],{"type":51,"value":704},{"type":51,"value":1598}," first",{"type":46,"tag":573,"props":1600,"children":1601},{},[1602,1607],{"type":46,"tag":605,"props":1603,"children":1604},{},[1605],{"type":51,"value":1606},"Reading full manifest.json",{"type":46,"tag":605,"props":1608,"children":1609},{},[1610],{"type":51,"value":1611},"Use jq to filter",{"type":46,"tag":573,"props":1613,"children":1614},{},[1615,1620],{"type":46,"tag":605,"props":1616,"children":1617},{},[1618],{"type":51,"value":1619},"Suggesting ETL changes",{"type":46,"tag":605,"props":1621,"children":1622},{},[1623],{"type":51,"value":1624},"Keep suggestions at semantic layer",{"type":46,"tag":573,"props":1626,"children":1627},{},[1628,1633],{"type":46,"tag":605,"props":1629,"children":1630},{},[1631],{"type":51,"value":1632},"Not checking tool availability",{"type":46,"tag":605,"props":1634,"children":1635},{},[1636],{"type":51,"value":1637},"List available tools before choosing approach",{"type":46,"tag":1639,"props":1640,"children":1641},"style",{},[1642],{"type":51,"value":1643},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":1645,"total":307},[1646,1660,1668,1681,1695,1712,1724,1739,1753,1765,1777,1788],{"slug":1647,"name":1647,"fn":1648,"description":1649,"org":1650,"tags":1651,"stars":27,"repoUrl":28,"updatedAt":1659},"adding-dbt-unit-test","add dbt unit tests","Creates unit test YAML definitions that mock upstream model inputs and validate expected outputs. Use when adding unit tests for a dbt model or practicing test-driven development (TDD) in dbt.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1652,1653,1656],{"name":17,"slug":17,"type":15},{"name":1654,"slug":1655,"type":15},"Testing","testing",{"name":1657,"slug":1658,"type":15},"YAML","yaml","2026-04-06T18:09:14.01391",{"slug":4,"name":4,"fn":5,"description":6,"org":1661,"tags":1662,"stars":27,"repoUrl":28,"updatedAt":29},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1663,1664,1665,1666,1667],{"name":19,"slug":20,"type":15},{"name":13,"slug":14,"type":15},{"name":17,"slug":17,"type":15},{"name":25,"slug":26,"type":15},{"name":22,"slug":23,"type":15},{"slug":1669,"name":1669,"fn":1670,"description":1671,"org":1672,"tags":1673,"stars":27,"repoUrl":28,"updatedAt":1680},"building-dbt-semantic-layer","build dbt Semantic Layer components","Use when creating or modifying dbt Semantic Layer components — semantic models, metrics, dimensions, entities, measures, or time spines. Covers MetricFlow configuration, metric types (simple, derived, cumulative, ratio, conversion), and validation for both latest and legacy YAML specs.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1674,1675,1678,1679],{"name":19,"slug":20,"type":15},{"name":1676,"slug":1677,"type":15},"Data Engineering","data-engineering",{"name":17,"slug":17,"type":15},{"name":25,"slug":26,"type":15},"2026-07-18T05:12:20.387564",{"slug":1682,"name":1682,"fn":1683,"description":1684,"org":1685,"tags":1686,"stars":27,"repoUrl":28,"updatedAt":1694},"configuring-dbt-mcp-server","configure dbt MCP server","Generates MCP server configuration JSON, resolves authentication setup, and validates server connectivity for dbt. Use when setting up, configuring, or troubleshooting the dbt MCP server for AI tools like Claude Desktop, Claude Code, Cursor, or VS Code.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1687,1690,1691],{"name":1688,"slug":1689,"type":15},"Agent Context","agent-context",{"name":17,"slug":17,"type":15},{"name":1692,"slug":1693,"type":15},"MCP","mcp","2026-04-06T18:09:12.757804",{"slug":1696,"name":1696,"fn":1697,"description":1698,"org":1699,"tags":1700,"stars":27,"repoUrl":28,"updatedAt":1711},"creating-mermaid-dbt-dag","generate Mermaid diagrams of dbt model lineage","Generates a Mermaid flowchart diagram of dbt model lineage using MCP tools, manifest.json, or direct code parsing as fallbacks. Use when visualizing dbt model lineage and dependencies as a Mermaid diagram in markdown format.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1701,1704,1705,1708],{"name":1702,"slug":1703,"type":15},"Data Pipeline","data-pipeline",{"name":17,"slug":17,"type":15},{"name":1706,"slug":1707,"type":15},"Diagrams","diagrams",{"name":1709,"slug":1710,"type":15},"Documentation","documentation","2026-04-06T18:09:15.270247",{"slug":1713,"name":1713,"fn":1714,"description":1715,"org":1716,"tags":1717,"stars":27,"repoUrl":28,"updatedAt":1723},"fetching-dbt-docs","search dbt documentation","Retrieves and searches dbt documentation pages in LLM-friendly markdown format. Use when fetching dbt documentation, looking up dbt features, or answering questions about dbt Cloud, dbt Core, or the dbt Semantic Layer.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1718,1719,1720],{"name":17,"slug":17,"type":15},{"name":1709,"slug":1710,"type":15},{"name":1721,"slug":1722,"type":15},"Reference","reference","2026-04-06T18:09:06.36975",{"slug":1725,"name":1725,"fn":1726,"description":1727,"org":1728,"tags":1729,"stars":27,"repoUrl":28,"updatedAt":1738},"migrating-dbt-core-to-fusion","triage dbt-core to Fusion migration errors","Use when a user needs help triaging dbt-core to Fusion migration errors. Runs dbt-autofix first, then classifies remaining errors into actionable categories (auto-fixable, guided fixes, needs input, blocked).",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1730,1731,1732,1735],{"name":1676,"slug":1677,"type":15},{"name":17,"slug":17,"type":15},{"name":1733,"slug":1734,"type":15},"Migration","migration",{"name":1736,"slug":1737,"type":15},"Triage","triage","2026-04-06T18:09:01.250175",{"slug":1740,"name":1740,"fn":1741,"description":1742,"org":1743,"tags":1744,"stars":27,"repoUrl":28,"updatedAt":1752},"migrating-dbt-project-across-platforms","migrate dbt projects across data platforms","Use when migrating a dbt project from one data platform or data warehouse to another (e.g., Snowflake to Databricks, Databricks to Snowflake) using dbt Fusion's real-time compilation to identify and fix SQL dialect differences.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1745,1746,1749,1750,1751],{"name":1676,"slug":1677,"type":15},{"name":1747,"slug":1748,"type":15},"Database","database",{"name":17,"slug":17,"type":15},{"name":1733,"slug":1734,"type":15},{"name":22,"slug":23,"type":15},"2026-04-06T18:09:02.513828",{"slug":1754,"name":1754,"fn":1755,"description":1756,"org":1757,"tags":1758,"stars":27,"repoUrl":28,"updatedAt":1764},"running-dbt-commands","run dbt CLI commands","Formats and executes dbt CLI commands, selects the correct dbt executable, and structures command parameters. Use when running models, tests, builds, compiles, or show queries via dbt CLI. Use when unsure which dbt executable to use or how to format command parameters.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1759,1762,1763],{"name":1760,"slug":1761,"type":15},"CLI","cli",{"name":1676,"slug":1677,"type":15},{"name":17,"slug":17,"type":15},"2026-04-06T18:09:03.791122",{"slug":1766,"name":1766,"fn":1767,"description":1768,"org":1769,"tags":1770,"stars":27,"repoUrl":28,"updatedAt":1776},"troubleshooting-dbt-job-errors","troubleshoot dbt job errors","Diagnoses dbt Cloud\u002Fplatform job failures by analyzing run logs, querying the Admin API, reviewing git history, and investigating data issues. Use when a dbt Cloud\u002Fplatform job fails and you need to diagnose the root cause, especially when error messages are unclear or when intermittent failures occur. Do not use for local dbt development errors.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1771,1772,1773],{"name":1702,"slug":1703,"type":15},{"name":17,"slug":17,"type":15},{"name":1774,"slug":1775,"type":15},"Debugging","debugging","2026-04-06T18:09:05.065669",{"slug":1778,"name":1778,"fn":1779,"description":1780,"org":1781,"tags":1782,"stars":27,"repoUrl":28,"updatedAt":1787},"using-dbt-for-analytics-engineering","build dbt models and tests","Builds and modifies dbt models, writes SQL transformations using ref() and source(), creates tests, and validates results with dbt show. Use when doing any dbt work - building or modifying models, debugging errors, exploring unfamiliar data sources, writing tests, or evaluating impact of changes.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1783,1784,1785,1786],{"name":19,"slug":20,"type":15},{"name":1676,"slug":1677,"type":15},{"name":17,"slug":17,"type":15},{"name":22,"slug":23,"type":15},"2026-04-06T18:09:11.455851",{"slug":1789,"name":1789,"fn":1790,"description":1791,"org":1792,"tags":1793,"stars":27,"repoUrl":28,"updatedAt":1800},"using-dbt-state","configure and optimize dbt state","Use when a user is enabling, configuring, optimizing, or debugging dbt State (the server-backed reuse mechanism that clones or skips nodes instead of rebuilding them). Use when they conflate dbt State with the `state:modified` selector or `--state` deferral. Use when asked about models rebuilding unexpectedly, views with `select *` rebuilding, volatile SQL (`current_timestamp()`, `random()`) rebuilding or not, cross-developer cloning, lag_tolerance.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1794,1795,1796,1797],{"name":1676,"slug":1677,"type":15},{"name":1702,"slug":1703,"type":15},{"name":17,"slug":17,"type":15},{"name":1798,"slug":1799,"type":15},"Performance","performance","2026-06-25T07:12:16.623154",{"items":1802,"total":280},[1803,1809,1817,1824,1830,1837,1843],{"slug":1647,"name":1647,"fn":1648,"description":1649,"org":1804,"tags":1805,"stars":27,"repoUrl":28,"updatedAt":1659},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1806,1807,1808],{"name":17,"slug":17,"type":15},{"name":1654,"slug":1655,"type":15},{"name":1657,"slug":1658,"type":15},{"slug":4,"name":4,"fn":5,"description":6,"org":1810,"tags":1811,"stars":27,"repoUrl":28,"updatedAt":29},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1812,1813,1814,1815,1816],{"name":19,"slug":20,"type":15},{"name":13,"slug":14,"type":15},{"name":17,"slug":17,"type":15},{"name":25,"slug":26,"type":15},{"name":22,"slug":23,"type":15},{"slug":1669,"name":1669,"fn":1670,"description":1671,"org":1818,"tags":1819,"stars":27,"repoUrl":28,"updatedAt":1680},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1820,1821,1822,1823],{"name":19,"slug":20,"type":15},{"name":1676,"slug":1677,"type":15},{"name":17,"slug":17,"type":15},{"name":25,"slug":26,"type":15},{"slug":1682,"name":1682,"fn":1683,"description":1684,"org":1825,"tags":1826,"stars":27,"repoUrl":28,"updatedAt":1694},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1827,1828,1829],{"name":1688,"slug":1689,"type":15},{"name":17,"slug":17,"type":15},{"name":1692,"slug":1693,"type":15},{"slug":1696,"name":1696,"fn":1697,"description":1698,"org":1831,"tags":1832,"stars":27,"repoUrl":28,"updatedAt":1711},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1833,1834,1835,1836],{"name":1702,"slug":1703,"type":15},{"name":17,"slug":17,"type":15},{"name":1706,"slug":1707,"type":15},{"name":1709,"slug":1710,"type":15},{"slug":1713,"name":1713,"fn":1714,"description":1715,"org":1838,"tags":1839,"stars":27,"repoUrl":28,"updatedAt":1723},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1840,1841,1842],{"name":17,"slug":17,"type":15},{"name":1709,"slug":1710,"type":15},{"name":1721,"slug":1722,"type":15},{"slug":1725,"name":1725,"fn":1726,"description":1727,"org":1844,"tags":1845,"stars":27,"repoUrl":28,"updatedAt":1738},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1846,1847,1848,1849],{"name":1676,"slug":1677,"type":15},{"name":17,"slug":17,"type":15},{"name":1733,"slug":1734,"type":15},{"name":1736,"slug":1737,"type":15}]