Generated banner for Sqldw CLI
Generated logo for Sqldw CLI

Sqldw CLI

MicrosoftOfficialPublished by Microsoft

  • Skill
  • Tool integration
  • Data and AI
  • MIT
  • No issues found

From the author

Manage Fabric Warehouse, Lakehouse SQL endpoints, and Mirrored Databases: DDL/DML, COPY INTO, read-only T-SQL, Query Insights diagnostics, and Capacity Metrics CU-spike correlation. Synapse migration target SQL belongs to synapse-migration; Fabric SQL database belongs to sqldb-cli. Triggers: query warehouse, create warehouse table, failed or canceled query, CU spike, Capacity Metrics app, custom SQL pool, Lakehouse table health.
— the description by Microsoft

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

The sqldw-cli skill provides a structured interface for interacting with Microsoft Fabric data storage items, including Warehouses, Lakehouse SQL analytics endpoints, and Mirrored Databases. It operates through three distinct modes—authoring, consumption, and operations—to handle T-SQL execution, data ingestion, and performance diagnostics. The skill relies on the fabric-sqlendpoint-execute_query MCP tool for data-plane operations and requires users to consult specific mode references to ensure correct T-SQL syntax and operational constraints.

What it does

  • Executes DDL and DML statements for schema management and data manipulation in Fabric Warehouses.
  • Supports data ingestion via COPY INTO and OPENROWSET patterns.
  • Provides read-only querying capabilities for data exploration and metadata discovery.
  • Enables performance diagnostics using Query Insights and capacity metrics correlation.
  • Facilitates Lakehouse table health monitoring and diagnostic reporting.
  • Dispatches requests to specialized modes based on user intent to ensure safe and accurate execution.

When to use it

  • When you need to create, modify, or drop tables and schemas within a Fabric Warehouse.
  • When performing bulk data ingestion from external storage into a Warehouse.
  • When querying data or metadata from a Warehouse, Lakehouse SQL endpoint, or Mirrored Database.
  • When investigating performance issues, such as slow queries or CU spikes, using diagnostic views.
  • When correlating capacity consumption with specific SQL queries or users.

Advantages

  • Centralizes management of diverse Fabric SQL-based data items under a single skill.
  • Enforces mode-specific safety boundaries to prevent accidental mutations in read-only contexts.
  • Provides clear diagnostic paths for performance tuning and capacity management.
  • Standardizes T-SQL execution through a dedicated MCP tool interface.
  • Includes mandatory telemetry headers for consistent tracking across Fabric API calls.

Usage examples

“How many rows are in the nyctlc table in SkillsTestWarehouse?”
The agent selects the consumption mode, reads the consumption reference, and executes a SELECT COUNT(*) query via the MCP tool to return the exact row count.
“Create dbo.Orders in the warehouse with OrderId, CustomerId and OrderDate.”
The agent selects the authoring mode, reads the authoring reference, executes the CREATE TABLE statement, and performs a readback query to confirm the table exists.
“Which queries are slowest, and which tables should I cluster?”
The agent selects the operations mode, reads the operations reference, and executes diagnostic queries against queryinsights to identify slow-running patterns.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/microsoft/sqldw-cli/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip sqldw-cli.zip -d .agents/skills

Documentation by Microsoft

Telemetry — MANDATORY. Every api.fabric.microsoft.com call must carry x-ms-fabric-skill: sqldw-cli (az rest: --headers "x-ms-fabric-skill=sqldw-cli"), including every LRO poll, fabric_lro and retry. Snippets omit it — add it anyway. This covers all three modes; the mode references inherit it.

CRITICAL NOTES

  1. To find the workspace details (including its ID) from workspace name: list all workspaces and, then, use JMESPath filtering

  2. To find the item details (including its ID) from workspace ID, item type, and item name: list all items of that type in that workspace and, then, use JMESPath filtering

  3. Skill disambiguation: use sqldw-cli for T-SQL sent to a Warehouse, a Lakehouse SQL analytics endpoint, or a Mirrored Database, including plain Lakehouse table SELECT, row-count, filtering, and aggregation requests. Target Warehouse SQL executed within an end-to-end Azure Synapse or Dedicated SQL Pool migration belongs to synapse-migration; standalone Warehouse work before or after migration returns to sqldw-cli. Any notebook-cell or PySpark DataFrame work is spark-cli; a Fabric SQL database (OLTP) is sqldb-cli.

Fabric Warehouse and SQL Endpoints — CLI Skill

This one skill owns Fabric Warehouse, Lakehouse SQL analytics endpoints and Mirrored Databases: T-SQL authoring and ingestion, read-only querying, and warehouse performance diagnostics.

It is a mode dispatcher and contains NO procedures. Pick the mode that matches the request from the table below, then read the matching references/<mode>.md file end to end with your file-reading tool BEFORE issuing a single command. That file holds the T-SQL surface area, DDL constraints, query templates and gotchas; acting without it produces invalid T-SQL and wrong results.

Mode selection

ModeUse when the request ...Example triggersRead this first
authoringchanges warehouse state: table DDL, DML, ingestion, transactions, procedures, schema evolution, time travelcreate warehouse table, COPY INTO, OPENROWSET, INSERT/UPDATE/DELETE, warehouse MERGE, CTAS, sp_rename, create T-SQL procedure, warehouse time travelreferences/authoring.md
consumptionreads data or metadata: SELECT, row counts, filtering, aggregation, schema/object discovery, CSV exportquery warehouse, count rows lakehouse, SELECT lakehouse, show tables, describe warehouse schema, export SQL datareferences/consumption.md
operationsdiagnoses performance, failures, capacity consumption, SQL pool usage, or health through queryinsights and supported endpoint diagnosticsfailed or canceled warehouse queries, CU spike, Capacity Metrics app, expensive SQL users, custom SQL pool recommendation, queryinsights CPU, pressure events, cache warmth, Lakehouse tables needing attentionreferences/operations.md

Operations reference index

Read references/operations.md first for any operations request, then open the matching leaf directly from this index. Do not chain from links inside a leaf; for composite requests, follow scenarios.md only to the additional leaves that this index links directly.

RequestRead this leaf reference
composite operations scenarios such as why is my warehouse slow, performance degradation, optimization, or what are people runningreferences/operations/scenarios.md
slow-query summaries, top users, recent queries, pattern search, runtime profiles, cluster-key candidatesreferences/operations/query-reference.md
failed or canceled requests, error codes, recurring non-successful query shapesreferences/operations/failure-analysis.md
SQL pool pressure windows and overlapping requestsreferences/operations/pool-pressure.md
CPU concentration, regressions, repeated expensive queries, cache interpretationreferences/operations/resource-consumers.md
Lakehouse Delta file health and tables needing maintenancereferences/operations/lakehouse-health.md
Capacity Metrics CU spike, costly item, SQL query/user correlationreferences/operations/capacity-metrics-correlation.md — start at section 1
custom SQL pool recommendation for an already identified SQL endpointreferences/operations/capacity-metrics-correlation.md — skip FabricIQ and start at section 6
Mode boundary rule

Classify by intent, not by endpoint — all three modes issue the same execute_query call.

  • A schema-discovery SELECT run to plan a CREATE TABLE belongs to authoring, even though it only reads.

  • A SELECT that answers the user's question is consumption.

  • A query against queryinsights.* or a supported diagnostic such as Lakehouse sys.sp_get_table_health_metrics is operations; a SELECT against user tables is not, however slow it is.

consumption and operations are read-only. If a request genuinely spans modes, handle them one at a time and read each reference before you start that part. If the mode is ambiguous after reading this table, ask one short clarifying question instead of guessing.

Terminal write — the step you must not skip

Reading the reference and drafting the T-SQL is NOT completing the task. If you did not send the statement, nothing changed — say so explicitly rather than reporting success.

ModeTerminal write
authoringThe DDL/DML itself, sent through execute_query. Follow it with a readback in a second call (SELECT ... FROM INFORMATION_SCHEMA.TABLES after CREATE, SELECT COUNT(*) after DML) and report the object you created or changed under the name the user asked for. Only a Warehouse accepts table DDL/DML — see the mode reference for what a Lakehouse SQL endpoint and a Mirrored Database allow.
consumptionnone — this mode is read-only
operationsnone — read-only, but you must still run the diagnostic statements: every figure comes from a SELECT or documented read-only diagnostic procedure executed in the turn you report it, cited inline with its source view or procedure, never carried forward from an earlier turn. The only allowed diagnostic EXEC is sys.sp_get_table_health_metrics on a Lakehouse SQL analytics endpoint. Never execute ALTER, CREATE or DROP yourself, even when the diagnosis is certain.
consumption and operations reporting

Neither read-only mode has a terminal write, so its deliverable is the answer itself. Run the query against the live endpoint and report the real rows — a summary of the reference does not answer the request.

In operations, name the source view, catalog, or procedure each figure came from right next to it (for example 2,140 ms (queryinsights.long_running_queries) or 268 files (sys.sp_get_table_health_metrics)), including when the answer is zero rows. Re-run the diagnostic in the turn you report it rather than restating an earlier turn's output. Never fabricate, assume or infer diagnostic numbers.

Shared essentials (all modes)

Every mode reaches the data plane the same way. Resolve the workspace and item first, then send T-SQL through the MCP tool.

Execution surface — fabric-sqlendpoint-execute_query

All T-SQL runs through the fabric-sqlendpoint-execute_query MCP tool. For SQL data-plane execution this skill supersedes the COMMON-CLI SQL/TDS guidance — use the MCP tool, not sqlcmd, unless you are explicitly on the documented Legacy CLI Fallback path (see the mode reference). az rest stays the right tool for control-plane discovery.

fabric-sqlendpoint-execute_query(workspaceId, itemId, query)
  • Preflight, before the first operation of any mode: confirm a tool whose name ends in execute_query is in your tool list. It comes from the fabric-sqlendpoint MCP server, registered by a Fabric skills plugin or this repo's .mcp.json. The concrete name may be prefixed (fabric-sqlendpoint-execute_query, sqlendpoint-global-execute_query) — invoke the name you actually see. If none is present, say so, then fall back to the Legacy CLI Fallback (TDS client) documented in the mode reference; tell the user they can register the server for the primary path — see mcp-setup/. Exception: the Capacity Metrics correlation workflow is intentionally limited to the existing FabricIQ and SQL Endpoint MCP surfaces; if SQL Endpoint MCP is unavailable, report that phase as blocked and do not use the legacy fallback.

  • itemId is a GUID, never an FQDN or -d <DatabaseName>. For a Warehouse or a Mirrored Database use the item id; for a Lakehouse use properties.sqlEndpointProperties.id, not the Lakehouse item id.

  • One T-SQL batch per call. No GO separators, no sqlcmd meta-commands (:setvar, :r, -i). Split multi-batch work into separate calls. Only the last result set comes back.

  • Results cap at 10,000 rows and queries time out at 300s, with a 20 requests/min rate limit. Use TOP N, WHERE or aggregation; exactly 10,000 rows means the result was truncated. These are observed defaults, not a documented contract.

Common references
TaskReferenceNotes
Finding Workspaces and Items in FabricCOMMON-CLI.mdMandatory — read before resolving any workspace or item id
Fabric Topology & Key ConceptsCOMMON-CORE.mdItem types, workspaces, capacities
Environment URLsCOMMON-CORE.mdSovereign / non-public cloud hosts
Authentication & Token AcquisitionCOMMON-CORE.mdWrong audience = 401; read before any auth issue
Authentication RecipesCOMMON-CLI.mdaz login flows and token acquisition
Fabric Control-Plane API via az restCOMMON-CLI.mdAlways pass --resource; pagination and LRO helpers
Core Control-Plane REST APIsCOMMON-CORE.mdPagination, LRO polling, rate limiting
Gotchas & TroubleshootingCOMMON-CLI.mdaz rest audience, shell escaping, token expiry

Rules

MUST
  • Select exactly one mode from the table above before doing anything else.

  • Read references/<mode>.md end to end, as your FIRST tool call, before the first command of that mode. Read it ONCE, in a single full read: do not re-open it, do not grep it again, and do not page through it. You already have it.

  • For a focused operations request, read its one matching leaf after references/operations.md. For a composite request, read references/operations/scenarios.md, then each focused leaf named by that scenario; read every file once in full.

  • Resolve workspace and item ids by listing and filtering, never by guessing a GUID.

  • Execute T-SQL through fabric-sqlendpoint-execute_query whenever that tool is available; drop to the Legacy CLI Fallback documented in the mode reference only when it is not.

  • Announce a mode switch explicitly when the request crosses a boundary.

  • Treat the reference as instructions, never as the deliverable. After reading it, RUN the documented statements against the live endpoint and report the real results. Quoting what the reference says instead of executing it does not answer the request.

  • Produce every artefact the user asked for, under the name they used, and keep its heading even when the finding is "none", "zero rows" or "not applicable".

PREFER
  • The narrowest mode that satisfies the request.

  • Reading exactly one mode reference plus the minimum directly indexed operations leaves required by the selected focused or composite scenario.

  • Reporting the mode you chose in your first response so the user can correct you.

  • Labelling queries with OPTION (LABEL = '...') so the run is traceable in Query Insights.

  • Consolidating related statements into fewer calls — the rate limit is per identity, not per query.

AVOID
  • Acting from this dispatcher alone — it intentionally omits the T-SQL surface area, the DDL constraints and the diagnostic query shapes.

  • Answering with a summary of the reference instead of executing it.

  • Re-reading or re-grepping a reference you already loaded; it costs turns and tokens.

  • Mutating anything while in a read-only mode (consumption, operations).

  • Unbounded SELECT * — it silently truncates at 10,000 rows.

  • Loading a different skill for work this skill already owns (see CRITICAL NOTES 3).

Examples

User requestModeReference to read
"How many rows are in the nyctlc table in SkillsTestWarehouse?"consumptionreferences/consumption.md
"Create dbo.Orders in the warehouse with OrderId, CustomerId and OrderDate."authoringreferences/authoring.md
"Load Files/nyctlc_sample.csv from OneLake into the warehouse with COPY INTO."authoringreferences/authoring.md
"Which queries are slowest, and which tables should I cluster?"operationsreferences/operations.md
"Show me the average trip distance per vendor from the lakehouse SQL endpoint."consumptionreferences/consumption.md

Files

references/operations/scenarios.md

<!-- Composite operations scenarios linked directly from sqldw-cli/SKILL.md. -->

SQL DW Operations Scenarios

Use this guide when the request spans more than one focused operations workflow. It restores the original operations scenarios while keeping corrected SQL and endpoint rules in the directly indexed focused references.

Contents

  • Response contract

  • Analyze failed or canceled queries

  • Analyze SQL pool pressure

  • Analyze top resource consumers

  • Analyze Lakehouse tables needing attention

  • Explain why a warehouse is slow

  • Determine whether performance degraded

  • Find evidence-backed optimization targets

  • Explain what people are running

  • Correlate a Capacity Metrics CU spike

  • Assess custom SQL pools

  • Examples

Response contract

Return exactly these headings in order:

## Diagnosis
## Evidence
## Ruled out
## Recommendations
## Follow-ups

Every figure must come from a diagnostic run in the current turn and cite its source view or procedure. Treat zero rows and not-applicable results as valid findings.

Follow-ups are for the user operating the investigated environment. Give concrete next actions on the target workload, SQL item, capacity, or report window and say what to remeasure. Keep retention, lag, timezone, and correlation-confidence caveats in Evidence or Ruled out. Do not propose changes to the skill, PR, tests, documentation, or analysis implementation unless the user explicitly requested development work. If no action is warranted, say so and name the signal that should trigger reinvestigation.

1. Analyze failed or canceled queries

Use for failure history, cancellation, error-code, and recurring non-successful-query questions.

  1. Read the directly indexed failure-analysis.md reference.

  2. Establish failed, canceled, and combined scope for the requested UTC interval.

  3. Resolve observed failed error codes through sys.messages; do not resolve cancellations as engine errors.

  4. Identify recurring query shapes, users, programs, pools, and individual requests.

  5. Test pressure or cache explanations only when the evidence makes them relevant.

2. Analyze SQL pool pressure

Use for pressure incidents and requests asking what competed for SQL pool resources.

  1. Read the directly indexed pool-pressure.md reference.

  2. Build intervals from all state events, retaining the pressure-off event as the closing boundary.

  3. Summarize affected pools, interval count and duration, peak resource percentage, and capacity SKU.

  4. Correlate requests using both strict time overlap and exact sql_pool_name.

  5. Describe overlap as correlation, not proof.

3. Analyze top resource consumers

Use for dominant compute, repeated expensive queries, and regressions.

  1. Read the directly indexed resource-consumers.md reference.

  2. Measure allocated-CPU concentration and select the smallest leading set reaching 50%, capped at five query hashes.

  3. Compare the recent window with the immediately preceding normalized baseline.

  4. Separate execution-volume growth, per-run regression, one-off cost, and distributed workload.

  5. Inspect individual executions and interpret historical cache fields without recommending unavailable result-set caching.

4. Analyze Lakehouse tables needing attention

Use only for a Lakehouse SQL analytics endpoint.

  1. Read the directly indexed lakehouse-health.md reference.

  2. Reject Warehouse and Mirrored Database targets as not applicable.

  3. Enumerate every user table.

  4. Run sys.sp_get_table_health_metrics once per fully qualified table, respecting rate limits.

  5. Report Delta file sizes, row counts, deleted rows, checkpoints, and procedure-reported anomalies without substituting SQL optimizer statistics.

5. Explain why a warehouse is slow

  1. Read pool-pressure.md and check the requested interval for contention.

  2. Read resource-consumers.md and identify CPU concentration, expensive executions, and cache/storage behavior.

  3. Read query-reference.md only when long-running summaries or runtime profiles are also needed.

  4. Distinguish pressure, query cost, remote scans, cold starts, and distributed workload; do not list untested tuning knobs.

6. Determine whether performance degraded

  1. Read resource-consumers.md and compare the requested recent window with a non-overlapping normalized baseline.

  2. Read query-reference.md for long-running summaries and top-user patterns when needed.

  3. Classify new query shapes separately from existing-query regressions.

  4. Report the underlying recent and baseline values with every ratio.

7. Find evidence-backed optimization targets

  1. Read resource-consumers.md to identify repeated CPU, elapsed-time, and scan cost.

  2. Read query-reference.md for cluster-key candidates derived from filter predicates and table usage.

  3. Read pool-pressure.md when elapsed time is high relative to CPU.

  4. Recommend only actions supported by the observed evidence. Operations mode never applies CTAS, clustering, cache, or capacity changes.

8. Explain what people are running

  1. Read the Recent Warehouse Activity section in query-reference.md.

  2. Run its bounded request query and summarize users, programs, statement types, query shapes, and pools.

  3. Search query text only for a user-supplied table, column, label, or keyword.

  4. Bound every query and exclude agent monitoring statements.

9. Correlate a Capacity Metrics CU spike

  1. Read capacity-metrics-correlation.md from section 1.

  2. Discover the installed Capacity Metrics model through the existing FabricIQ MCP.

  3. Inspect the live schema and choose its timestamped item/hour or fixed-window capacity-health branch.

  4. Keep fixed-window health separate from broader non-timestamped item totals; treat empty drillthrough tables as unavailable evidence.

  5. Resolve a Warehouse or Lakehouse SQL endpoint only when same-timeframe evidence identifies it as a costly contributor. Otherwise stop spike correlation and offer Query Insights as a separately scoped investigation.

  6. Use the overall Capacity Metrics spike window to retrieve all overlapping Query Insights requests for the resolved SQL item, then analyze their users, applications, query shapes, CPU, elapsed time, scans, status, and pool pressure.

  7. Treat those requests as best-effort time correlation. Capacity Metrics Operation Id is not Query Insights distributed_statement_id and must not be joined to it.

  8. Keep CU seconds and Query Insights CPU milliseconds as separate signals.

  9. Turn evidence gaps into user actions only when actionable: confirm the report timezone, inspect non-SQL operations for unexplained intervals, or add and refresh missing Warehouse sources in the user's correlation model. Otherwise keep the gap as a stated limitation.

10. Assess custom SQL pools

  1. Read capacity-metrics-correlation.md starting at section 6; skip FabricIQ when the SQL endpoint is already identified.

  2. Use one anchored historical interval across workload and pressure queries.

  3. Group by stable program_name, pool, statement type, and day.

  4. Recommend preview custom pools only for recurring contention and stable application classifiers.

  5. Do not infer pool percentages from CU seconds or CPU milliseconds and do not configure pools.

  6. Tell the user which classifier to pilot, which workload it isolates, and which pressure, CPU, scan, latency, and failure measures to compare after the pilot.

Examples

Find slow queries

User: “What are the slowest queries in my warehouse?”

Run the long-running summary from query-reference.md, cite the live Query Insights values, and separate repeated slowness from a single expensive execution.

Diagnose performance degradation

User: “Is my warehouse slower than last week?”

Run the normalized recent-versus-baseline workflow from resource-consumers.md, then check pressure and top-user evidence only when needed to explain the change.

Get clustering recommendations

User: “Which tables should I cluster and on what columns?”

Use current Query Insights filter and scan evidence from query-reference.md. Recommend supported CTAS with CLUSTER BY for an authoring follow-up, but do not execute it in operations mode.

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs an MCP server

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
Microsoft
Publisher
Microsoft (Official)
Source
microsoft/skills-for-fabric · skills/sqldw-cli · commit f8fac11
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced
Also distributed in
microsoft/skills-for-fabric

AutoGineer is not affiliated with or endorsed by Microsoft or Microsoft.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download sqldw-cli.zip