Skip to content

Add create_shortcut for external data source shortcuts - #1259

Draft
Michael Kovalsky (m-kovalsky) with Copilot wants to merge 1 commit into
mainfrom
copilot/create-shortcut-function
Draft

Add create_shortcut for external data source shortcuts#1259
Michael Kovalsky (m-kovalsky) with Copilot wants to merge 1 commit into
mainfrom
copilot/create-shortcut-function

Conversation

Copilot AI commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Adds a wrapper for the Fabric Create Shortcut API to create OneLake shortcuts pointing at external data sources. This replaces the previously disabled create_shortcut stub, which only handled adlsGen2/amazonS3 with a hardcoded Tables path and was never exported.

Changes

  • lakehouse/_shortcuts.py: New @log-decorated create_shortcut supporting adlsGen2, amazonS3, googleCloudStorage, and s3Compatible sources.
    • Adds shortcut_path (Files/Tables), bucket (required for s3Compatible), and shortcut_conflict_policy (Abort/GenerateUniqueName) parameters.
    • Fail-fast validation on source, shortcut_path, bucket, and shortcut_conflict_policy; full numpydoc docstring and type hints.
  • lakehouse/__init__.py: Exports create_shortcut.

Example

from sempy_labs.lakehouse import create_shortcut

create_shortcut(
    shortcut_name="sales",
    location="https://myaccount.dfs.core.windows.net",
    subpath="container/sales",
    source="adlsGen2",
    connection_id="00000000-0000-0000-0000-000000000000",
    lakehouse="MyLakehouse",
    workspace="MyWorkspace",
)

Note: the issue requested src/sempy_labs/shortcut, which does not exist; the function was added to src/sempy_labs/lakehouse/_shortcuts.py alongside the existing create_shortcut_onelake, delete_shortcut, and list_shortcuts.

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.

2 participants