Skip to main content

Local Fabric table cache, lakehouse read/write, and deploy for modular Python on Microsoft Fabric

Project description

laken

The missing local development workflow for Microsoft Fabric.

laken lets you develop Python code for Fabric locally, using the tools you already trust.

Write code on your machine, run it against real Fabric lakehouse tables (cached under .laken/).

When you're ready, laken deploy packages your project, publishes it to a Fabric Environment, and makes it available to your Fabric notebooks.

Your code stays modular. Your notebooks stay thin. And your local workflow survives contact with the platform.

Why “laken”?

Laken, pronounced LAH-kuhn, is Dutch for “cloth.” If you're feeling generous, it's a pun on Fabric and data lakes.


Installation

Install uv if needed, then add laken:

uv add laken
pip install laken

Deploy uses uv to build your wheel before publishing to a Fabric environment.


Quickstart

1. Credentials — create a .env in your project root:

AZURE_TENANT_ID=...
AZURE_CLIENT_ID=...
AZURE_CLIENT_SECRET=...
FABRIC_WORKSPACE_NAME=MyWorkspace
FABRIC_LAKEHOUSE_NAME=MyLakehouse
FABRIC_WORKSPACE_ID=...
FABRIC_LAKEHOUSE_ID=...

2. Develop locally — first read_table pulls from Fabric and caches Delta under .laken/:

from laken import Lakehouse

lh = Lakehouse()
df = lh.read_table("customers", frame_type="pandas")
lh.write_table(df, "customer_analytics")

In a Fabric notebook, the same calls use your attached lakehouse (Spark by default).

3. Package and deploy — standard src/ layout plus FABRIC_ENVIRONMENT_ID in .env:

laken deploy

4. Run in a notebook:

from laken import Lakehouse
from myapp.pipeline import run_pipeline

lh = Lakehouse()
run_pipeline(lh)

Table names

Use a bare table name or schema.table (for example products or marketing.products).

Cross-lakehouse or multi-part Fabric names are not supported — use Spark directly in the notebook for those reads.


Local Fabric cache

Locally, the first read_table for a Fabric-backed table downloads into .laken/ as Delta. Later reads use the cache until you refresh or reset.

  • Tables 100 MB or smaller (from the Delta log) are mirrored in full.
  • Larger tables cache the first 10,000 rows as a development sample.
lh = Lakehouse(max_mirror_mb=200, max_sample_rows=5_000)

Local writes stay under .laken/ and do not sync to Fabric. Run laken refresh <table> when you need the latest Fabric data. Run laken reset <table> to discard local edits and re-download from Fabric.

Cache metadata is stored in .laken/metadata/tables.json.


Deploy to Fabric

myapp/
├── pyproject.toml
├── src/myapp/pipeline.py
└── .env
FABRIC_WORKSPACE_ID=...
FABRIC_ENVIRONMENT_ID=...
laken deploy

Reference

Lakehouse

from laken import Lakehouse

lh = Lakehouse()

Reads and writesmode is "overwrite" or "append".

df = lh.read_table("products")                         # pandas locally, Spark in Fabric
df = lh.read_table("marketing.products", frame_type="polars")
lh.write_table(df, "staging.products_snapshot")

CLI

laken deploy [--workspace-id <id>] [--environment-id <id>]
laken refresh <table>
laken reset <table>

Environment variables

Loaded from .env when you construct Lakehouse or run the CLI (shell variables win).

Variable Purpose
AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET Auth
FABRIC_WORKSPACE_NAME, FABRIC_LAKEHOUSE_NAME Local Fabric fetch
FABRIC_WORKSPACE_ID, FABRIC_LAKEHOUSE_ID OneLake paths
FABRIC_ENVIRONMENT_ID Deploy target

Testing

Inject a fetcher in unit tests:

from laken.local_lakehouse import LocalLakehouse

Development

uv sync
uv run pytest
uv run ruff check

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

laken-0.2.1.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

laken-0.2.1-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file laken-0.2.1.tar.gz.

File metadata

  • Download URL: laken-0.2.1.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.12

File hashes

Hashes for laken-0.2.1.tar.gz
Algorithm Hash digest
SHA256 423e2488e2b985e932e875e1317ac045067f782c97a4cd3eef56002871701869
MD5 f9a077a95652a3bdf38ca979edf98380
BLAKE2b-256 02f5fe6853e54fb01f7dee1010fdff1d0590cea5b7a5bcf277187a200411a468

See more details on using hashes here.

File details

Details for the file laken-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: laken-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.12

File hashes

Hashes for laken-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 33e3d03e661b98e74a7d8772fbd918d77684cb1028ee161ff105f396ab9f586e
MD5 49638be2e97909db11db4fbff4c4ae04
BLAKE2b-256 b739ef0a752a761985308376b6d0f50b6589e6bc8be7dd88a9f330466ce3b483

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page