Lesson 15 – Access data in OneLake using API

Getting your data in OneLake is easy, and there are different ways to do it – like using the Fabric portal, OneLake File Explorer, or APIs and SDKs. In this blog, we’ll focus on how you can access your OneLake data using APIs. Let’s explore the simplicity and effectiveness of using OneLake APIs to get your data effortlessly.

URI

Access your OneLake data effortlessly by using any API that’s compatible with ADLS Gen2, simply by incorporating a OneLake URI. This streamlined approach allows you to interact with your data using familiar APIs, ensuring a seamless experience.

URI Syntax

You can use this special address (URI) to easily reach specific objects and paths anywhere in your Fabric tenant.

GUIDs

OneLake provides support for referencing workspaces and items using globally unique identifiers (GUIDs). Each workspace and item in OneLake is assigned a unique GUID that remains constant, even if there are changes to the workspace or item name.

GUID syntax

When utilizing GUIDs in OneLake, it’s important to note that you must use the GUIDs for both the workspace and the item, and there’s no need to specify the item type. This ensures a stable and unchanging reference, making it a reliable method for accessing and identifying specific elements in OneLake.

To find the associated GUID for your workspace or item, you can locate it in the URL on the Fabric portal.

Simple Guidelines for Using Other API Tools

When working with  various API tools with OneLake, employ the following straightforward mapping:

  • Account Name: Always specify “onelake” as your account name.
  • Container Name: Use your workspace name as the designated container name.
  • Data Path: Start your data path directly from the item level. For example, /mylakehouse.lakehouse/Files/.

Following these simple rules ensures smooth compatibility with different API tools, making your experience with OneLake hassle-free. This standardized approach guarantees consistency and efficiency, allowing you to effortlessly integrate OneLake into your preferred API workflows.

Azure Blob Filesystem (ABFS)

OneLake extends its compatibility by supporting the Azure Blob Filesystem (ABFS) driver, making it even more versatile with ADLS Gen2 and Azure Blob Storage. The ABFS driver introduces its scheme identifier, abfs, along with a distinct URI format for interacting with files and directories within ADLS Gen2 accounts.

Using ABFS URI Format in OneLake

To employ the ABFS URI format over OneLake, a simple substitution and inclusion are required:

  • Replace “workspace” with “filesystem.”
  • Include the item and item type in the URI.

Example ABFS URI:

By adopting this format, OneLake ensures extended compatibility with ABFS, broadening your possibilities for interaction with ADLS Gen2 and Azure Blob Storage seamlessly.

Authorisation

Authenticating with OneLake is like unlocking a door with your Microsoft Entra ID – just include a special code (authorization header). OneLake doesn’t really care which membership card you have (Azure subscription). It’s simple and works with tools that can log you into your Azure account. It only needs your personal pass (user token) for access.

Data Residency

When using the global OneLake address (https://onelake.dfs.fabric.microsoft.com), there’s no guarantee your data will stay in one specific place. If your workspace and data are in different regions, the data might move outside its original area. To keep your data firmly in one region and avoid it wandering, use the right address – it’s like ensuring your data stays in its own neighbourhood. You can find this specific address by checking the region of your workspace’s capacity.

Suppose your workspace is connected to a capacity in the East Europe region; your specific address would then be https://easteurope-onelake.dfs.fabric.microsoft.com.