Forum Discussion

PAC8309's avatar
PAC8309
Regular Visitor
1 year ago
Solved

Shortcut List using spark in Notebooks

Hello,   I would like to know if it is possible to get a list using spark in notebook of all shorcut tables in a specific lakehouse without using the API (OneLake Shortcuts - List Shortcuts - REST ...
  • Vinodh247's avatar
    1 year ago

    Fabric currently does not expose a builtin spark method or metadata table that allows you to list OneLake shortcuts directly frm a spark notebook within a Lakehouse. The officially supported way to list shortcuts is through the REST API (list shortcuts core API) that you referenced. If you list tables using spark.catalog.listTables(), this will only show the managed or external tables registered in the metastore & not the shortcuts unless those they are mounted and registered as tables. As a workaround you can maintain a metadata table manually in your Lakehouse listing shortcuts & use the REST API externally (via Fabric Notebook using requests with access_token) and write the results to a Delta table for downstream use.