sqldw-consumption-cli

Execute read-only T-SQL queries against Fabric Warehouses and Lakehouse SQL endpoints via sqlcmd CLI.

Updated Jul 14, 2026
One-click install
npx skills add https://github.com/9vantage/skills-for-fabric-clone --skill sqldw-consumption-cli-9vantage
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sqldw-consumption-cli
Source: https://github.com/9vantage/skills-for-fabric-clone/tree/main/plugins/fabric-skills/skills/sqldw-consumption-cli
Command: npx skills add https://github.com/9vantage/skills-for-fabric-clone --skill sqldw-consumption-cli-9vantage

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Querying Microsoft Fabric Warehouses, Lakehouse SQL Endpoints, and Mirrored Databases from the command line requires correct endpoint discovery, Entra ID authentication, and knowledge of the supported T-SQL surface area, which is error-prone without guidance. ## Core Features & Use Cases - Endpoint Discovery & Connection: Resolve workspace and item IDs via Fabric REST APIs with JMESPath filtering, then connect using sqlcmd (Go) with Entra ID authentication. - Agentic Data Exploration: Follow a structured schema discovery sequence (schemas, tables, columns, row counts, samples) to chat with lakehouse or warehouse data. - Script Generation & Export: Produce reusable Bash and PowerShell scripts for CSV export, parameterized date-range queries, schema reports, and performance investigation using queryinsights DMVs. - Use Case: Ask how many rows exist in a lakehouse table; the skill discovers the SQL endpoint, authenticates via az login, runs the count query with sqlcmd, and can export results to CSV. ## Quick Start Ask the assistant to show the tables in your Fabric lakehouse and count the rows in a specific table using the sqldw-consumption-cli skill.

Frequently Asked Questions about sqldw-consumption-cli

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I query a Microsoft Fabric lakehouse from the command line?

Use sqlcmd (Go) with the -G flag for Entra ID authentication against the lakehouse SQL endpoint FQDN, discovered via the Fabric REST API. Run az login first, then execute queries with sqlcmd -S <endpoint> -d <database> -G -Q "SELECT ...".

How do I find the SQL endpoint connection string for a Fabric warehouse?

Call the Fabric REST API with az rest: GET /v1/workspaces/{workspaceId}/warehouses/{itemId} and read properties.connectionString. For lakehouses, use properties.sqlEndpointProperties.connectionString from the lakehouses endpoint.

Can I run INSERT or UPDATE statements on a Lakehouse SQL endpoint?

No. Lakehouse SQL Endpoints and Mirrored Database endpoints are read-only; DML statements fail on them. Data modification is only supported on Fabric Data Warehouse items.

Why does sqlcmd fail with 'Login failed for user' on Fabric?

This usually means the database name passed with -d does not exactly match the item name (case-sensitive) or the identity lacks access. Verify the database name and ensure az login was completed with the correct tenant.

How do I export Fabric warehouse query results to CSV?

Run sqlcmd with -W to trim trailing spaces, -s"," for comma separation, -h 1 for headers, and -o results.csv to write output to a file. Prepend SET NOCOUNT ON; to suppress row-count messages that corrupt the CSV.

Which sqlcmd version works with Microsoft Fabric?

Use the Go-based sqlcmd, installable via winget install sqlcmd or brew install sqlcmd, which has built-in Entra ID authentication. The older ODBC-based sqlcmd at /opt/mssql-tools/bin/sqlcmd requires an ODBC driver and should be avoided.