1---2name: fabric-lakehouse3description: Use when designing Microsoft Fabric Lakehouse architecture, working with Delta tables, OneLake storage, Spark notebooks, or studying for DP-700 (Microsoft Fabric Data Engineer Associate). Covers Fabric architecture, Delta Lake, OneLake shortcuts, and medallion patterns.4---56# Fabric Lakehouse78## When to Use9- Designing a Lakehouse in Microsoft Fabric for analytics workloads10- Working with Delta tables, time travel, or schema enforcement11- Planning OneLake shortcuts to external data sources (ADLS Gen2, S3, GCS)12- Deciding between Lakehouse and Warehouse for a use case13- Preparing for Microsoft Fabric Data Engineer Associate (DP-700) exam1415## Core Jobs1617### 1. Fabric Architecture Overview18- **Lakehouse** = OneLake storage + Delta table format + SQL analytics endpoint + Spark runtime19- All Fabric items (Lakehouse, Warehouse, Eventhouse, Semantic Model) share **OneLake** as single storage20- OneLake = Azure Data Lake Storage Gen2 compatible; one logical lake per Fabric tenant21- Lakehouse exposes two interfaces: **Spark** (read/write Delta) and **SQL analytics endpoint** (read-only T-SQL)2223### 2. Lakehouse vs Warehouse Decision24| Capability | Lakehouse | Warehouse |25|------------|-----------|-----------|26| Storage format | Delta (Parquet + transaction log) | Proprietary columnar |27| Query interface | SQL analytics endpoint (read-only) + Spark | Dedicated SQL (read/write T-SQL) |28| Write via SQL | No (Spark or Dataflow only) | Yes (INSERT, UPDATE, DELETE) |29| Spark support | Yes (PySpark, Scala, R) | No |30| Best for | Data engineering, ML prep, exploration | BI reporting, T-SQL-heavy analytics |3132Decision rule: Choose **Lakehouse** when you need Spark + open Delta format; choose **Warehouse** when your team is SQL-first and needs T-SQL DML.3334### 3. Delta Lake Format and ACID Transactions35- All Lakehouse managed tables are **Delta format** (Parquet files + `_delta_log/`)36- ACID transactions: atomic commits prevent partial writes; concurrent reads/writes safe37- **Time travel**: query historical snapshots using:38 - `SELECT * FROM table VERSION AS OF 10` — by version number39 - `SELECT * FROM table TIMESTAMP AS OF '2024-01-15'` — by timestamp40- Schema enforcement: Delta rejects writes that don't match the declared schema41- Schema evolution: `mergeSchema` option allows adding new columns4243### 4. OneLake Shortcuts44- **Shortcuts** = logical pointers to external data; no data copy into OneLake45- Supported sources: ADLS Gen2, Amazon S3, GCS, OneLake (cross-workspace)46- Data stays at the source; access latency depends on source location and network47- Shortcuts appear as folders in Lakehouse; queryable via SQL analytics endpoint and Spark48- Use shortcuts when data must remain in source system for compliance or ownership reasons4950### 5. Spark Notebooks in Lakehouse51- Default language: PySpark (also supports Scala, R, Spark SQL)52- Read Delta table: `spark.read.format("delta").load("abfss://...")`53- Write Delta table: `df.write.format("delta").mode("overwrite").save("Tables/mytable")`54- Shortcut: `spark.read.load("Files/shortcut-folder/")` — treats shortcuts as local paths55- ML feature prep: use Spark for large-scale feature engineering before model training5657### 6. Medallion Architecture in Fabric58| Layer | Lakehouse | Content |59|-------|-----------|---------|60| **Bronze** | Raw Lakehouse | Ingested as-is; no transformations; full fidelity |61| **Silver** | Cleaned Lakehouse | Validated, deduplicated, typed data |62| **Gold** | Curated Lakehouse | Aggregated, business-ready for BI and reporting |6364- Each layer can be a separate Lakehouse or schema within one Lakehouse65- Silver and Gold tables exposed via SQL analytics endpoint to Power BI (Direct Lake mode)6667## Key Concepts68- **OneLake** — single logical Azure Data Lake per Fabric tenant; all items read/write here69- **Delta Lake** — open-source storage layer; ACID, time travel, schema enforcement on Parquet70- **SQL analytics endpoint** — auto-generated, read-only SQL interface over Lakehouse Delta tables71- **Direct Lake mode** — Power BI reads Delta tables directly from OneLake (no import, no DirectQuery overhead)72- **Shortcut** — virtual link to external storage; zero data copy; Fabric-native access73- **Managed table** — Delta table in `Tables/` section; registered in Lakehouse metastore74- **Unmanaged file** — raw file in `Files/` section; not a Delta table; no SQL access7576## Checklist77- [ ] Lakehouse chosen over Warehouse when Spark or open Delta format is required?78- [ ] Medallion architecture (Bronze/Silver/Gold) layers defined for data quality progression?79- [ ] Delta tables in `Tables/` section (not `Files/`) for SQL analytics endpoint access?80- [ ] OneLake shortcuts used for external data instead of copying data in?81- [ ] Time travel retention configured (default 7 days; extend for audit requirements)?82- [ ] SQL analytics endpoint connected to Power BI using Direct Lake mode?83- [ ] Schema enforcement enabled; mergeSchema only when intentional evolution needed?8485## Output Format86- 🔴 **Critical** — writing data to `Files/` section expecting SQL access (Files are not Delta tables)87- 🔴 **Critical** — using Lakehouse SQL analytics endpoint for write operations (it is read-only)88- 🟡 **Warning** — copying data into OneLake when a shortcut could avoid duplication89- 🟡 **Warning** — no medallion layering; raw data directly served to Power BI90- 🟢 **Suggestion** — enable Direct Lake mode on Gold layer semantic model for best BI performance9192## Exam Tips93- **Lakehouse SQL analytics endpoint = auto-generated, read-only** — cannot INSERT/UPDATE via SQL endpoint; writes must go through Spark, Dataflow Gen2, or Pipelines94- **Shortcuts = no data copy** — data stays at source; latency depends on source; no egress costs within same region95- **Delta time travel** — `VERSION AS OF` for version number, `TIMESTAMP AS OF` for date; default 7-day retention96- **Lakehouse tables vs Files** — `Tables/` = Delta format, SQL-queryable; `Files/` = raw files, Spark-only97- **OneLake = one copy shared across Fabric** — Lakehouse, Warehouse, and Semantic Model all reference the same OneLake storage; no duplication98- **Medallion architecture in Fabric** — Bronze → Silver → Gold; each layer a separate Lakehouse or schema; Gold exposed to Power BI via Direct Lake