Edit

Share via


Get started with materialized lake views

In this article, you learn how to get started and create materialized lake views (MLV) in a lakehouse in Microsoft Fabric.

Prerequisites

Create your first materialized lake view

  1. Go to your lakehouse and select Manage materialized lake views.

    Screenshot showing materialized lake view.

  2. Select New materialized lake view and click on New notebook to open a new notebook.

    Screenshot showing how to open notebook to create new materialized lake view.

    Screenshot showing notebook template to create new materialized lake view.

  3. Create sample source tables products and orders. Run the following commands in the notebook.

       CREATE SCHEMA IF NOT EXISTS bronze;
    
       CREATE TABLE IF NOT EXISTS bronze.products (
        product_id INT,
        product_name STRING,
        price DOUBLE
       );
    
       INSERT INTO bronze.products VALUES
       (101, 'Laptop', 1200.50),
       (102, 'Smartphone', 699.99),
       (103, 'Tablet', 450.00);
    
    
       CREATE TABLE IF NOT EXISTS bronze.orders (
         order_id INT,
         product_id INT,
         quantity INT,
         order_date DATE
        );
       INSERT INTO bronze.orders VALUES
        (1001, 101, 2, '2025-06-01'),
        (1002, 103, 1, '2025-06-02'),
        (1003, 102, 3, '2025-06-03');
    
  4. Create materialized lake views using the source tables. Run the following commands in the notebook.

       CREATE SCHEMA IF NOT EXISTS SILVER;
    
       CREATE MATERIALIZED LAKE VIEW IF NOT EXISTS silver.cleaned_order_data AS
       SELECT 
           o.order_id,
           o.order_date,
           o.product_id,
           p.product_name,
           o.quantity,
           p.price,
           o.quantity * p.price AS revenue
       FROM bronze.orders o
       JOIN bronze.products p
       ON o.product_id = p.product_id;
    
       CREATE SCHEMA IF NOT EXISTS GOLD;
    
       CREATE MATERIALIZED LAKE VIEW IF NOT EXISTS gold.product_sales_summary AS
       SELECT
           product_id,
           product_name,
           SUM(quantity) AS total_quantity_sold,
           SUM(revenue) AS total_revenue,
           ROUND(AVG(revenue), 2) AS average_order_value
       FROM
           silver.cleaned_order_data
       GROUP BY
           product_id,
           product_name;
    
  5. Open Lakehouse explorer to view all created tables and MLVs.

    Screenshot showing materialized lake views created in lakehouse.

  6. Navigate to the Manage materialized lake views option in your Lakehouse to view the autogenerated lineage.

    Screenshot showing lineage.

  7. Schedule the lineage execution.

    Screenshot showing how to schedule the lineage.

  8. Click on the ongoing run to monitor progress once the schedule starts.

    Screenshot showing progress of ongoing run.

  9. Once the run succeeds, the lineage will display as completed.

    Screenshot showing completed lineage run.

Next steps