Turn on OneLake availability for an eventhouse

You can create a logical copy of KQL database data in an eventhouse by turning on OneLake availability. When you turn on OneLake availability, you can query the data in your KQL database in Delta Lake format through other Fabric engines such as Direct Lake mode in Power BI, Warehouse, Lakehouse, Notebooks, and more. Delta Lake is the unified data lake table format that makes seamless data access possible across all compute engines in Fabric.

In this article, you learn how to turn on availability of KQL database data in OneLake.

When OneLake availability and schema synchronization are enabled, you can also use Analyze data with > SQL analytics endpoint at the database level to query the Delta Lake representation in near real time through SQL-based engines.

How OneLake availability works for KQL databases

You can turn on OneLake availability at the database or table level. When enabled at the database level, all new tables and their data are made available in OneLake. When turning on the feature, you can also choose to apply this option to existing tables by selecting the Apply to existing tables option, to include historic backfill. Turning on at the table level makes only that table and its data available in OneLake. The Data retention policy of your KQL database is also applied to the data in OneLake. Data removed from your KQL database at the end of the retention period is also removed from OneLake. If you turn off OneLake availability, data is soft deleted from OneLake.

Schema synchronization keeps the Delta Lake representation aligned with the KQL database. Newly ingested data is available to query in near real time through the SQL analytics endpoint and notebooks. For details, see Near real-time latency.

While OneLake availability is turned on, you can't do the following tasks:

  • Rename tables.
  • Alter a column type. Adding or deleting a column is supported.
  • Apply row-level security to tables.
  • Delete, truncate, or purge data.

If you need to do any of these tasks, use the following steps:

  1. Turn off OneLake availability.
  2. Perform the task.
  3. Turn on OneLake availability.

Important

Turning off OneLake availability soft deletes your data from OneLake. When you turn availability back on, all data is available in OneLake, including historic backfill.

Note

There's no extra storage cost to turn on OneLake availability. For more information, see resource consumption.

Prerequisites

Turn on OneLake availability for a KQL database or table

You can turn on OneLake availability for either a KQL database or table.

  1. Select a database or table.

  2. In the OneLake section of the details pane, set Availability to Enabled.

    Screenshot of the OneLake section of the Database details pane showing the Availability option highlighted.

  3. In the Enable OneLake availability window, select Enable.

    Screenshot of the Enable OneLake availability window showing the Apply to existing tables option.

  4. The database or table details refresh automatically.

    Screenshot of the OneLake section details once Availability is set to Enabled. The option to expose data to OneLake is turned on.

When you turn on OneLake availability in your KQL database or table, you can access all the data at the given OneLake path in Delta Lake format. You can also create a OneLake shortcut from a lakehouse or warehouse, or query the data directly via Power BI Direct Lake mode. With the OneLake availability in your KQL database or table turned on, you can now access all the data at the given OneLake path in Delta Lake format. You can also create a OneLake shortcut from a Lakehouse, Data Warehouse, or query the data directly via Power BI Direct Lake mode.

Use with Analyze data with options

When OneLake availability is enabled, Eventhouse and KQL database items expose Analyze data with options at the database level:

  • SQL analytics endpoint: Available when both OneLake availability and schema synchronization are enabled.
  • Notebook: Opens notebook-based analysis for the selected database.

If you turn off OneLake availability, the SQL analytics endpoint option is removed from this menu until you enable it again.

Near real-time latency

An eventhouse makes newly ingested data available in OneLake in near real time, even when data arrives in small batches. In the background, the service continuously optimizes the Delta table by compacting small Parquet files into larger ones to keep queries efficient.

Note

Some databases or tables where you previously enabled OneLake availability might still use delayed batching. To switch to near-real-time updates, turn OneLake availability off and then turn it back on. Turning it off soft deletes the OneLake copy. When you turn it back on, the service backfills historical data.

Monitor OneLake availability

OneLake availability uses open mirroring. To track mirroring progress or investigate a failure, query the MirroredDatabaseTableExecution table in your workspace monitoring database. For details, see Mirrored database operation logs.

View Delta Lake files in OneLake

When you turn on OneLake availability on a table, the process creates a delta log folder along with any corresponding JSON and Parquet files. You can view the files that are available in OneLake and their properties while staying within Real-Time Intelligence.

  • To view the files, hover over a table in the Explorer pane and then select the More menu [...] > View files.

    Screenshot of the Explorer pane showing the More menu dropdown of a table.

  • To view the properties of the delta log folder or the individual files, hover over the folder or file and then select the More menu [...] > Properties.

  • To view the files in the delta log folder:

    1. Select the _delta_log folder.
    2. Select a file to view the table metadata and schema. The editor that opens is in read-only format.

Access the OneLake mirroring policy

By default, when you turn on OneLake availability for a KQL database or table, the system enables a mirroring policy. You can monitor mirroring progress or change the policy to partition Delta tables.

Note

If you turn off OneLake availability, the mirroring policy's IsEnabled property is set to false (IsEnabled=false).

Partition delta tables in OneLake

You can partition your delta tables to improve query speed. For information about when to partition your OneLake files, see When to partition tables. Each partition is represented as a separate column using the PartitionName listed in the Partitions list. This representation means your OneLake copy has more columns than your source table.

To partition your delta tables, use the .alter-merge table policy mirroring command.

Query Delta tables from a Fabric notebook

You can use Fabric Notebook to read the OneLake data using the following code snippet.

Tip

You can launch a new or existing Fabric notebook directly from Analyze data with > Notebook on an Eventhouse or KQL database. The notebook automatically attaches to the selected database context. Use the following code sample when you want manual path-based access.

In the code snippet, replace <workspaceGuid>, <workspaceGuid>, and <tableName> with your own values.

delta_table_path = 'abfss://<workspaceGuid>@onelake.dfs.fabric.microsoft.com/<eventhouseGuid>/Tables/<tableName>'

df = spark.read.format("delta").load(delta_table_path)

df.show()

Note

For an Azure Data Explorer database, use this code:

delta_table_path = 'abfss://<workspaceName>@onelake.dfs.fabric.microsoft.com/<itemName>.KustoDatabase/Tables/<tableName>'