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
Download the skill as a ZIP:
https://autogineer.com/agent-skills/microsoft/sqldw-cli/downloadUnzip 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.comcall must carryx-ms-fabric-skill: sqldw-cli(az rest:--headers "x-ms-fabric-skill=sqldw-cli"), including every LRO poll,fabric_lroand retry. Snippets omit it — add it anyway. This covers all three modes; the mode references inherit it.
CRITICAL NOTES
To find the workspace details (including its ID) from workspace name: list all workspaces and, then, use JMESPath filtering
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
Skill disambiguation: use
sqldw-clifor 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 tosynapse-migration; standalone Warehouse work before or after migration returns tosqldw-cli. Any notebook-cell or PySpark DataFrame work isspark-cli; a Fabric SQL database (OLTP) issqldb-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
| Mode | Use when the request ... | Example triggers | Read this first |
|---|---|---|---|
authoring | changes warehouse state: table DDL, DML, ingestion, transactions, procedures, schema evolution, time travel | create warehouse table, COPY INTO, OPENROWSET, INSERT/UPDATE/DELETE, warehouse MERGE, CTAS, sp_rename, create T-SQL procedure, warehouse time travel | references/authoring.md |
consumption | reads data or metadata: SELECT, row counts, filtering, aggregation, schema/object discovery, CSV export | query warehouse, count rows lakehouse, SELECT lakehouse, show tables, describe warehouse schema, export SQL data | references/consumption.md |
operations | diagnoses performance, failures, capacity consumption, SQL pool usage, or health through queryinsights and supported endpoint diagnostics | failed 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 attention | references/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.
| Request | Read this leaf reference |
|---|---|
| composite operations scenarios such as why is my warehouse slow, performance degradation, optimization, or what are people running | references/operations/scenarios.md |
| slow-query summaries, top users, recent queries, pattern search, runtime profiles, cluster-key candidates | references/operations/query-reference.md |
| failed or canceled requests, error codes, recurring non-successful query shapes | references/operations/failure-analysis.md |
| SQL pool pressure windows and overlapping requests | references/operations/pool-pressure.md |
| CPU concentration, regressions, repeated expensive queries, cache interpretation | references/operations/resource-consumers.md |
| Lakehouse Delta file health and tables needing maintenance | references/operations/lakehouse-health.md |
| Capacity Metrics CU spike, costly item, SQL query/user correlation | references/operations/capacity-metrics-correlation.md — start at section 1 |
| custom SQL pool recommendation for an already identified SQL endpoint | references/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
SELECTrun to plan aCREATE TABLEbelongs toauthoring, even though it only reads.A
SELECTthat answers the user's question isconsumption.A query against
queryinsights.*or a supported diagnostic such as Lakehousesys.sp_get_table_health_metricsisoperations; aSELECTagainst 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.
| Mode | Terminal write |
|---|---|
authoring | The 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. |
consumption | none — this mode is read-only |
operations | none — 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_queryis in your tool list. It comes from thefabric-sqlendpointMCP 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.itemIdis a GUID, never an FQDN or-d <DatabaseName>. For a Warehouse or a Mirrored Database use the item id; for a Lakehouse useproperties.sqlEndpointProperties.id, not the Lakehouse item id.One T-SQL batch per call. No
GOseparators, 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,WHEREor aggregation; exactly 10,000 rows means the result was truncated. These are observed defaults, not a documented contract.
Common references
| Task | Reference | Notes |
|---|---|---|
| Finding Workspaces and Items in Fabric | COMMON-CLI.md | Mandatory — read before resolving any workspace or item id |
| Fabric Topology & Key Concepts | COMMON-CORE.md | Item types, workspaces, capacities |
| Environment URLs | COMMON-CORE.md | Sovereign / non-public cloud hosts |
| Authentication & Token Acquisition | COMMON-CORE.md | Wrong audience = 401; read before any auth issue |
| Authentication Recipes | COMMON-CLI.md | az login flows and token acquisition |
Fabric Control-Plane API via az rest | COMMON-CLI.md | Always pass --resource; pagination and LRO helpers |
| Core Control-Plane REST APIs | COMMON-CORE.md | Pagination, LRO polling, rate limiting |
| Gotchas & Troubleshooting | COMMON-CLI.md | az rest audience, shell escaping, token expiry |
Rules
MUST
Select exactly one mode from the table above before doing anything else.
Read
references/<mode>.mdend 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, readreferences/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_querywhenever 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 request | Mode | Reference to read |
|---|---|---|
| "How many rows are in the nyctlc table in SkillsTestWarehouse?" | consumption | references/consumption.md |
| "Create dbo.Orders in the warehouse with OrderId, CustomerId and OrderDate." | authoring | references/authoring.md |
| "Load Files/nyctlc_sample.csv from OneLake into the warehouse with COPY INTO." | authoring | references/authoring.md |
| "Which queries are slowest, and which tables should I cluster?" | operations | references/operations.md |
| "Show me the average trip distance per vendor from the lakehouse SQL endpoint." | consumption | references/consumption.md |
Files
- ATTRIBUTION.mdAdded by AutoGineer863 B
- LICENSELicence file added by AutoGineer1.1 KiB
- SKILL.md14.2 KiB
- apm.yml608 B
- references/authoring.md26.7 KiB
- references/authoring/authoring-cli-quickref.md9.6 KiB
- references/authoring/authoring-script-templates.md7.3 KiB
- references/consumption.md20.6 KiB
- references/consumption/consumption-cli-quickref.md3.9 KiB
- references/consumption/discovery-queries.md5.9 KiB
- references/consumption/script-templates.md4.9 KiB
- references/operations.md18.6 KiB
- references/operations/capacity-metrics-correlation.md19.2 KiB
- references/operations/failure-analysis.md7.0 KiB
- references/operations/lakehouse-health.md2.6 KiB
- references/operations/pool-pressure.md4.0 KiB
- references/operations/query-reference.md17.8 KiB
- references/operations/resource-consumers.md7.6 KiB
- references/operations/scenarios.md8.5 KiB
references/operations.md
<!-- Mode reference for the `sqldw-cli` skill. Loaded on demand from `skills/sqldw-cli/SKILL.md` when the request matches the `operations` mode. -->
MODE-CRITICAL NOTES (operations mode)
queryinsights.*views exist on both a Warehouse and a Lakehouse SQL analytics endpoint, and reading them needs Contributor or higher on the workspace. Query Insights is always on — there is no setting to enable. A completed query lands in thequeryinsightsof the item it ran against.Every figure comes from a query you ran in the turn you report it, cited inline —
2,140 ms (queryinsights.long_running_queries). Do not carry numbers forward from an earlier turn: re-run the query. "I already ran the diagnostics" is not a source, and an uncited number reads as invented. Zero rows is a valid finding; never fill the gap from this reference.Read-only: use
SELECTdiagnostics. The only allowed non-SELECTstatement isEXEC sys.sp_get_table_health_metricson a Lakehouse SQL analytics endpoint. Do not issueALTER,CREATE,DROP,INSERT,UPDATE,DELETE,TRUNCATE, or aSETthat changes warehouse configuration — includingALTER DATABASE ... SET RESULT_SET_CACHING ON.A vague optimisation request ("just make my warehouse faster") is a new diagnostic question, not a summary request. Re-run the queries backing the levers you are about to name — in that same turn — then ask which target to pursue. Recommend only what those queries showed; never answer from earlier turns' output, and never list every knob that could be tuned.
sqldw-cli operations mode — Fabric SQL Endpoint Performance and Diagnostics
This skill provides performance analysis, deep diagnostics, and optimization guidance for Fabric Warehouse and Lakehouse SQL analytics endpoints via the fabric-sqlendpoint-execute_query MCP tool and built-in diagnostics. All queries are read-only.
Prerequisites
For workspace/item discovery via az rest, see COMMON-CLI.md § Fabric Control-Plane API via az rest. For legacy sqlcmd reference (fallback only), see COMMON-CLI.md § SQL / TDS Data-Plane Access.
⚠️ SQL Execution Override: For SQL data-plane execution, this skill supersedes COMMON-CLI SQL/TDS guidance. Use MCP
fabric-sqlendpoint-execute_query(see Tool Stack) unless explicitly using Legacy CLI Fallback.
Monitoring-specific requirements:
Workspace role: Contributor or higher on the target workspace (required for
queryinsightsviews)A Warehouse or Lakehouse SQL analytics endpoint must exist with recent query activity (
queryinsightsviews retain 30 days; data appears with up to 15 min delay)Lakehouse table health only:
VIEW DEFINITIONon the target SQL analytics endpoint
Table of Contents
| Task | Reference | Notes |
|---|---|---|
| Finding Workspaces and Items in Fabric | COMMON-CLI.md § Finding Workspaces and Items in Fabric | Mandatory — READ link first [needed for finding workspace id by its name or item id by its name, item type, and workspace id] |
| Connection Fundamentals | SQLDW-CONSUMPTION-CORE.md § Connection Fundamentals | TDS, port 1433, Entra-only, no MARS |
| Monitoring and Diagnostics | SQLDW-CONSUMPTION-CORE.md § Monitoring and Diagnostics | Query labels; DMVs (live) + queryinsights.* (30-day history) |
| Performance: Best Practices and Troubleshooting | SQLDW-CONSUMPTION-CORE.md § Performance: Best Practices and Troubleshooting | Statistics, caching, clustering, query tips |
| Gotchas and Troubleshooting (Consumption) | SQLDW-CONSUMPTION-CORE.md § Gotchas and Troubleshooting Reference | 18 numbered issues with cause + resolution |
| Data Ingestion (DW Only) | SQLDW-AUTHORING-CORE.md § Data Ingestion (DW Only) | COPY INTO, OPENROWSET, method comparison |
| Query Reference | query-reference.md | T-SQL queries, parameters, and example output for all analyses |
| Composite Recipes | COMMON-CLI.md § Composite Recipes | |
| Item-Type Capability Matrix | SQLDW-CONSUMPTION-CORE.md § Item-Type Capability Matrix | Read-vs-write scope by item type; queryinsights itself is available on both Warehouse and SQLEP |
| Prerequisites | SKILL.md § Prerequisites | Tools, auth, workspace role |
| Tool Stack | SKILL.md § Tool Stack | |
| Connection | SKILL.md § Connection | |
| Performance Analysis | SKILL.md § Performance Analysis | Long-running queries, resource consumers, user insights, baselines |
| Deep Diagnostics | SKILL.md § Deep Diagnostics | Pressure windows, cache warmth, cluster keys |
| Fabric DW Constraints | SKILL.md § Fabric DW Constraints | NEVER recommend unsupported features |
| Best Practices | SKILL.md § Best Practices | Monitoring-specific guidance |
| Gotchas, Rules, Troubleshooting | SKILL.md § Gotchas, Rules, Troubleshooting | MUST DO / AVOID / PREFER checklists |
Tool Stack
For installation and setup, see Prerequisites.
| Tool | Role |
|---|---|
fabric-sqlendpoint-execute_query MCP tool | Primary: Execute monitoring T-SQL queries against Fabric SQL Endpoints. Auth handled by MCP protocol. |
az CLI | Token acquisition, Fabric REST for workspace/item discovery |
jq | Parse JSON from az rest |
IMPORTANT — MCP vs sqlcmd: This skill uses the
fabric-sqlendpoint-execute_queryMCP tool for all T-SQL execution. Do not use COMMON-CLI SQL/TDS/sqlcmd sections for query execution.
Agent preflight — verify before first operation:
Confirm the
fabric-sqlendpoint-execute_querytool is available in your tool list. This tool is provided by thefabric-sqlendpointMCP server, which is registered either by installing a Fabric skills plugin (the path for end users) or via this repo's.mcp.json— other MCP clients may register it through their own configuration.If no matching tool is found, the user must register the Fabric SQL Endpoint MCP server.
Global URL:
https://api.fabric.microsoft.com/v1/mcp/dataPlane/sqlEndpointItem-scoped URL:
https://api.fabric.microsoft.com/v1/mcp/dataPlane/workspaces/{workspaceId}/items/{itemId}/sqlEndpoint
MCP Tool Signature
fabric-sqlendpoint-execute_query(workspaceId, itemId, query)Tool name may differ:
execute_queryis the logical operation. Depending on how the server is registered, the concrete tool name in your tool list may be prefixed (e.g.fabric-sqlendpoint-execute_queryorsqlendpoint-global-execute_query). Invoke the concrete name shown in your tool list, always passingworkspaceId,itemId, andquery.
| Parameter | Type | Description |
|---|---|---|
workspaceId | string (UUID) | The workspace GUID containing the target SQL endpoint item |
itemId | string (UUID) | Warehouse/Mirrored Database item ID, or a Lakehouse's properties.sqlEndpointProperties.id |
query | string | T-SQL query text (single batch — no GO separators) |
Returns: CSV resource (RFC 4180) with tabular results + metadata text.
Limits: 10,000 rows max | 300s timeout | 20 req/min rate limit (observed defaults, not a documented contract — the service can change them; verify against live 429/timeout/truncation responses)
Connection
Discover workspaceId and itemId
You need the workspace GUID and target SQL endpoint item GUID to call fabric-sqlendpoint-execute_query. For a Lakehouse, use properties.sqlEndpointProperties.id, not the Lakehouse item ID:
# 1. Find workspace ID by name (capture into WS_ID for the next call)
WS_ID=$(az rest --method get \
--resource "https://api.fabric.microsoft.com" \
--url "https://api.fabric.microsoft.com/v1/workspaces" \
--query "value[?displayName=='MyWorkspace'].id" --output tsv)
echo "Workspace ID: $WS_ID"
# 2. Find warehouse item ID by name
az rest --method get \
--resource "https://api.fabric.microsoft.com" \
--url "https://api.fabric.microsoft.com/v1/workspaces/$WS_ID/warehouses" \
--query "value[?displayName=='MyWarehouse'].id" --output tsvExecute a Monitoring Query
fabric-sqlendpoint-execute_query(
workspaceId: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
itemId: "11111111-2222-3333-4444-555555555555",
query: "SELECT TOP 5 * FROM queryinsights.long_running_queries ORDER BY last_run_total_elapsed_time_ms DESC"
)No additional connection setup needed — authentication is handled transparently by the MCP protocol.
Performance Analysis
General-purpose SQL queries remain in query-reference.md. Focused workflows use the leaf selected by the dispatcher, including queryinsights.exec_requests_history for request evidence and queryinsights.sql_pool_insights for pressure state events.
Long-Running Queries Summary
Find the slowest queries from queryinsights.long_running_queries. See query-reference.md § Long-Running Queries Summary for SQL and formatting.
Top Resource Consumers
Use the directly indexed references/operations/resource-consumers.md leaf for CPU concentration, baseline comparison, expensive executions, and cache interpretation.
Top Users Insights
Analyze user activity and query patterns. See query-reference.md § Top Users Insights for SQL and classification logic.
Compare Recent vs Baseline
Detect performance regressions by comparing recent window against historical baseline. See query-reference.md § Compare Recent vs Baseline for SQL and formatting.
Recent Queries
Retrieve the most recently executed queries. See query-reference.md § Recent Queries for SQL.
Search Query Patterns
Search historical query patterns by table name, column, or keyword. See query-reference.md § Search Query Patterns for SQL.
Deep Diagnostics
Use the focused leaf selected by the dispatcher when one exists; use query-reference.md only for the remaining general diagnostics.
Analyze Long-Running Query Runtime Profile
See query-reference.md § Long-Running Query Analysis for SQL.
Query Insights supplies runtime metrics, not an operator-level actual plan. Analyze a separate plan artifact only when the user supplies one.
Analysis guidance — when reviewing slow queries, check:
High
data_scanned_remote_storage_mb→ data layout issues (run OPTIMIZE, consider clustering)High
allocated_cpu_time_msrelative to elapsed → CPU-bound (simplify joins, reduce columns)High elapsed but low CPU → waiting on resources (check for pressure windows)
Analyze Pressure Window Queries
Read the directly indexed references/operations/pool-pressure.md leaf. It builds intervals from all state events with LEAD, preserves the pressure-off boundary, and correlates requests by both time and sql_pool_name.
Analyze Query Cache Warmth
Read the directly indexed references/operations/resource-consumers.md leaf. It handles zero-scan rows before ratios and records result_cache_hit values correctly. Result set caching is currently disabled due to a known issue, so use those fields only for historical interpretation and do not recommend enabling it unless current Microsoft documentation confirms the limitation is resolved.
Recommend Cluster Keys
See query-reference.md § Cluster Key Recommendations for SQL.
Key rules:
Only
WHEREpredicates benefit from clustering — equalityJOIN ONconditions do notPrefer mid-to-high cardinality columns (many distinct values)
Maximum 4 clustering columns
Use CTAS with
WITH (CLUSTER BY (...))—ALTER TABLEis not supported
To apply clustering — see query-reference.md § Cluster Key Recommendations for CTAS creation, sp_rename table swap, and verification SQL.
Note: Fabric does not support
ALTER TABLE SET DATA_CLUSTERING_KEYorRENAME OBJECT. Always use CTAS withWITH (CLUSTER BY (...))andsp_renamefor table swaps.
Fabric DW Constraints
NEVER recommend features not supported in Fabric Data Warehouse. Always consult this list before making optimization suggestions.
| Do NOT Recommend | Why | Recommend Instead |
|---|---|---|
| Nonclustered indexes | Not supported | V-Order, column pruning, predicate pushdown |
| Materialized views | Not supported | Standard views; result set caching is currently unavailable |
| Index hints (FORCESEEK/FORCESCAN) | Not supported | Simplify query structure |
| Multi-column statistics | Not supported | Single-column statistics on key columns |
ALTER TABLE SET DATA_CLUSTERING_KEY | Not supported | CTAS with WITH (CLUSTER BY (...)) |
RENAME OBJECT | Not supported | EXEC sp_rename 'schema.old', 'new' |
| Change isolation level | Snapshot only | Fabric uses snapshot isolation exclusively |
| CREATE USER | Not supported | Manage users via Fabric workspace |
| Triggers | Not supported | Application logic or Fabric pipelines |
| Recursive CTEs | Not supported | Iterative approach |
| "Enable Query Insights" setting | Query Insights is always on — there is no setting | If access is denied, the user needs Contributor or higher on the workspace |
Agentic Workflows
Start with the dispatcher-selected leaf, run only evidence required by the question, and expand to another directly indexed workflow only when the first result establishes that dependency.
Best Practices
For comprehensive Fabric DW best practices, see SQLDW-CONSUMPTION-CORE.md § Performance: Best Practices and Troubleshooting and the Fabric guidelines.
Monitoring-specific best practices:
Start broad, then drill down — begin with long-running queries summary and baseline comparison before deep diagnostics
Use pressure window analysis for root-cause analysis rather than guessing at bottlenecks
Label all agent queries with
OPTION (LABEL = 'AGENTCLI_MONITOR_...')for tracing in Query InsightsPrefer mid-to-high cardinality columns for clustering keys — low cardinality columns offer limited file-skipping benefit
Use
WHEREpredicates to identify cluster key candidates — equalityJOIN ONconditions do not benefit from clusteringAlways verify clustering after CTAS by querying
sys.index_columns.data_clustering_ordinalCheck cold vs warm cache before concluding a query is inherently slow — first execution may be a cold start
Adjust time windows (
DATEADDparameters) to match user's investigation scope — don't default to arbitrary windows
Gotchas, Rules, Troubleshooting
For generic CLI gotchas (connection, auth, shell escaping): see COMMON-CLI.md § Gotchas & Troubleshooting. For T-SQL/platform gotchas: see SQLDW-CONSUMPTION-CORE.md § Gotchas and Troubleshooting Reference.
MUST DO
Always check Fabric DW Constraints before recommending optimizations
When recommending clustering, instruct users to use CTAS with
WITH (CLUSTER BY (...))— not ALTER TABLEReport actual query output — do not fabricate or assume results
Label queries with
OPTION (LABEL = 'AGENTCLI_MONITOR_...')for Query Insights tracingVerify
fabric-sqlendpoint-execute_queryMCP tool availability before first operation
PREFER
Start with high-level queries (long-running summary, baseline comparison) before drilling into diagnostics
Use the pressure window analysis for root-cause analysis rather than guessing at bottlenecks
Adjust time windows (
DATEADDparameters) based on what the user asks forConsolidate related diagnostic queries into fewer calls to respect rate limits
AVOID
Recommending Fabric-unsupported features (nonclustered indexes, materialized views, index hints, triggers)
Suggesting that Query Insights needs to be "enabled" or "turned on" —
queryinsightsviews are always available; permission errors indicate insufficient workspace role (Contributor or higher required)Running monitoring queries without confirming workspaceId and itemId
Guessing at performance root causes without running the diagnostic queries
Using
SELECT *in monitoring queries — always select specific columnsUsing
GOseparators or sqlcmd meta-commands in queries (MCP tool accepts single batches only)Unbounded queries without
TOP N— 10,000 row limit applies
TROUBLESHOOTING (Monitoring-Specific)
For generic connection/auth troubleshooting, see COMMON-CLI.md § Gotchas & Troubleshooting.
| Symptom | Cause | Fix |
|---|---|---|
Invalid object name 'queryinsights...' | New warehouse < 2 min old | Wait ~2 minutes |
Permission errors on queryinsights.* | Insufficient workspace role | Requires Contributor or higher |
| No data in queryinsights views | No recent query activity or < 15 min delay | Wait 15 min after query completion |
| No rows but data exists | RLS filtering | Check USER_NAME(), verify RLS policies |
fabric-sqlendpoint-execute_query tool not available | MCP server not registered | User must add Fabric SQL Endpoint MCP server |
| HTTP 429 rate limit | Too many calls in 1 min | Wait 60s; consolidate queries |
| Query timeout (300s) | Complex diagnostics | Narrow time window with tighter DATEADD |
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