The SQL analytics endpoint in Fabric, explained

What the SQL analytics endpoint of a Fabric lakehouse is, what you can and cannot do with T-SQL there, and why a new table sometimes shows up late.

Short answer: every Fabric lakehouse (and mirrored database) comes with a SQL analytics endpoint: a read-only T-SQL view of its Delta tables. You can query the tables, and create views, functions, procedures and permissions on them, but you cannot insert, update or delete rows there. Tools that speak SQL, from SSMS to Excel, connect to it like a database.

It lets a SQL user read a lakehouse that Spark writes, without a copy. The one surprise is that it is read-only, and that it follows the lake with a short delay.

What can you do there?

StatementAllowed
SELECT from the lakehouse's tablesyes
CREATE VIEW, FUNCTION, PROCEDUREyes
GRANT, DENY, row-level and column-level securityyes
Queries across items in the workspaceyes, with three-part names
INSERT, UPDATE, DELETE, MERGE on tablesno, write with Spark
CREATE TABLEno, tables come from the lakehouse
T-SQL on a lakehouse's SQL analytics endpoint

A view for the report team, joining two tables the notebook wrote:

CREATE VIEW reporting.monthly_sales AS
SELECT d.[Year], d.[Month], c.Region, SUM(f.Amount) AS Revenue
FROM dbo.fact_sales AS f
JOIN dbo.dim_date AS d ON d.DateKey = f.DateKey
JOIN dbo.dim_customer AS c ON c.CustomerKey = f.CustomerKey
GROUP BY d.[Year], d.[Month], c.Region;

Why is a new table not there yet?

  1. 1
    Spark writesa Delta table in the lakehouse's Tables
  2. 2
    Syncthe endpoint reads the Delta log and updates its metadata
  3. 3
    T-SQLthe table and its new rows can be queried
How a table reaches the endpoint

The endpoint keeps its own metadata in step with the lake, and that sync runs in the background. Right after a notebook creates a table, a query can miss it for a short while. The endpoint's Refresh button, or the metadata sync API, runs the sync at once; a pipeline that queries straight after loading should call it first.

What goes wrong?

  • Only Delta tables appear. Files in the Files area, or tables in another format, are not visible to SQL.
  • Column names with spaces or odd types. Spark allows names and types that T-SQL handles badly. Name columns plainly in the notebook.
  • Security set in two places. Permissions on the endpoint do not stop someone with workspace access from reading the files through Spark. Control who has workspace roles first.

Where can you check this?

Where do you start?

Fabric lakehouse or warehouse says when read-only SQL is enough and when you need a warehouse. The open course A lakehouse in three layers ends with tables you can query here.

Keep reading

More from the blog.

Every post

Next

Building this? Say hello.

A question about this post, a pattern you would build differently, or the next thing you want written out: Behnia reads every message.