Forum Discussion

dave_fackler's avatar
dave_fackler
New Member
11 months ago
Solved

Error Reading Data from Mirrored Database Using Lakehouse Shortcut

I have a mirrored database set up in a trial Fabric workspace. The data is coming from an Azure SQL database. Works great. I have a lakehouse in the same workspace and I created a shortcut to the mir...
  • tayloramy's avatar
    11 months ago

    Hi dave_fackler

    This is supported, but you need the correct path and the right Fabric/OneLake permissions.

     

    The error text mentions “Storage Blob Data Contributor,” but with Fabric OneLake, access is governed by Fabric item/OneLake permissions rather than Azure Storage RBAC. For mirrored databases, make sure your account has Read all OneLake data on the mirrored database (Workspace ->the mirrored database -> Share). That permission explicitly allows accessing the mirrored data files from Spark/OneLake Explorer. Docs: Share your mirrored database & permissions

    It’s supported to read mirrored data from notebooks

    Mirroring lands your source tables as Delta files in OneLake. You can explore/query them with Spark in notebooks by creating a Lakehouse shortcut to the mirrored database/tables and reading from it. Docs: Explore mirrored data with notebooks - Mirroring overview

    Use the correct path (copy the ABFS path from the UI)

    1. In your Lakehouse, right-click the shortcut (or a table/file in it) -> Properties -> copy the ABFS path (or “Copy relative path for Spark” if it’s your default Lakehouse). Docs: Copy ABFS/relative paths
    2. Use that ABFS path in your notebook.
    # Example: read a mirrored Delta table through a Lakehouse shortcut (ABFS path)
    path = "abfss://<workspaceName>@onelake.dfs.fabric.microsoft.com/<lakehouseName>.lakehouse/Files/<shortcutName>/<schema>/<tableName>"
    df = spark.read.format("delta").load(path)
    display(df)

    ABFS path format example (from Microsoft docs): abfss://[email protected]/myLakehouse.lakehouse/Files/. Docs: OneLake ABFSS path example

    Tip: ensure the path targets the actual table folder that contains a _delta_log (that’s the Delta table root). Higher-level folders (schema/database only) won’t load as Delta tables. Delta read-by-path points to folder with _delta_log Delta logs live under _delta_log

    Even easier: add the shortcut under Tables

    If the target is Delta, create the shortcut in the Lakehouse Tables section (not Files). Fabric auto-discovers it as a table so you can read it like any managed table via Spark/SQL/semantic model.

    # Read a table-shortcut registered under Tables
    df = spark.read.table("dbo.MyShortcutTable")            # Spark
    # or
    spark.sql("SELECT * FROM dbo.MyShortcutTable").show()   # SQL

    Docs: OneLake shortcuts (Tables vs Files, auto-recognition) - Lakehouse & Delta tables (auto-discovery incl. shortcuts)

    Quick checklist

    • Grant yourself Read all OneLake data on the mirrored database (Share -> permissions). Docs
    • Copy the shortcut’s ABFS path (or relative path) and use it in spark.read.format("delta").load(...). Docs
    • Point to the actual table folder (must contain _delta_log). Docs
    • For Delta tables, prefer the shortcut in Tables so it’s addressable as a table. Docs

    If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, please mark this as the solution.