Skip to content

Fix get_direct_lake_sources failure when SQL endpoint source is referenced by name instead of GUID - #1336

Open
Michael Kovalsky (m-kovalsky) with Copilot wants to merge 6 commits into
mainfrom
copilot/append-vertipaq-analyzer-error
Open

Michael Kovalsky (m-kovalsky) with Copilot wants to merge 6 commits into
mainfrom
copilot/append-vertipaq-analyzer-error

Conversation

Copilot AI commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

vertipaq_analyzer() and get_direct_lake_sources() raised a FabricHTTPException (400) when a Direct Lake model's SQL Analytics Endpoint source expression referenced the lakehouse/warehouse by its friendly display name (e.g. LH_Admin) rather than its GUID. The code passed this name straight through to metadata/artifacts/{artifact_id}, which only accepts GUIDs.

FabricHTTPException: 400 The request could not be processed due to missing or invalid information for url: 
https://.../metadata/artifacts/LH_Admin

Changes

  • GUID detection: Check the artifact identifier extracted from the Sql.Database M expression with _is_valid_uuid before calling the artifacts API.
  • Name resolution: When the identifier isn't a GUID, resolve it by matching the exact display name against the workspace's Lakehouses/Warehouses.
  • Caching: The workspace item list is fetched once per get_direct_lake_sources() call and reused across all unresolved expressions to avoid redundant API calls.
  • Ambiguity handling: If a name matches zero or multiple items, the source is skipped with a warning instead of silently resolving to the wrong item or crashing.

Copilot AI and others added 4 commits September 16, 2026 16:16
Co-authored-by: m-kovalsky <29556918+m-kovalsky@users.noreply.github.com>
Co-authored-by: m-kovalsky <29556918+m-kovalsky@users.noreply.github.com>
Co-authored-by: m-kovalsky <29556918+m-kovalsky@users.noreply.github.com>
Co-authored-by: m-kovalsky <29556918+m-kovalsky@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Vertipaq Analyzer error for Lakehouse SQL Analytics endpoint Fix get_direct_lake_sources failure when SQL endpoint source is referenced by name instead of GUID Sep 16, 2026
@m-kovalsky
Michael Kovalsky (m-kovalsky) marked this pull request as ready for review September 18, 2026 06:54
Copilot AI lite review requested due to automatic review settings September 18, 2026 06:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Consumers must handle missing source descriptors or preserve an explicit failure.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Fixes Direct Lake source resolution when SQL expressions use lakehouse or warehouse names instead of GUIDs.

Changes:

  • Detects GUID identifiers.
  • Resolves friendly names by exact workspace-item matches.
  • Caches workspace items per call.
  • Warns and skips unresolved or ambiguous matches.
File summaries
File Summary
src/sempy_labs/tom/_model.py Adds name-based source resolution and caching; unresolved sources may cause incomplete results and downstream StopIteration failures.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/sempy_labs/tom/_model.py Outdated
f"'{name}' expression {reason} in the '{self._workspace_name}' "
"workspace and will be skipped."
)
continue

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d3a0949: instead of skipping and returning a partial sources list, we now raise a ValueError when a Direct Lake expression's referenced item can't be resolved to exactly one Lakehouse/Warehouse, so callers like vertipaq_analyzer() never end up with a missing descriptor.

Co-authored-by: m-kovalsky <29556918+m-kovalsky@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Append Vertipaq Analyzer Error When Model Connected to Lakehouse SQL Analytics Endpoint

3 participants