Build & develop

Notebooks and SQL

Notebooks in KratosForge look and work like Fabric's, but every cell runs in a Python kernel on your PC. Reading and writing lakehouse data goes straight to OneLake. A run on this PC starts no Fabric job, but its OneLake reads and writes still use the workspace's capacity. This page covers how to write, run, publish and schedule notebooks, which Fabric notebook code works here, and the SQL query tab.

Your first notebook#

  1. Create > Notebook (or New notebook on Home, or Ctrl+K "New notebook"). The notebook opens with one empty code cell.

  2. Add data items in the ribbon opens a OneLake catalog of every lakehouse you can reach. Select one to see its tables and files on the right, then Attach (or double-click it). The attached lakehouse shows in the Explorer on the left. New lakehouse at the bottom creates one and attaches it. The left side filters by Favorites, Endorsed or one workspace, as on the OneLake catalog: Favorites are the stars you click in the list, saved on this PC, and Endorsed is greyed out. A running cell keeps the lakehouse it started with: starting a cell from another notebook, or an external tool's run against another lakehouse, waits or is refused until it finishes.

  3. In the Explorer, click a table to insert code that loads it, or a file to insert code that reads it.

  4. Run the cell with Shift+Enter. Output shows below it.

  5. Write a result back:

    import polars as pl
    from fabric_desktop import lakehouse
    
    sales = lakehouse.read_csv("Files/raw/sales.csv")          # from the attached lakehouse
    by_region = sales.group_by("region").agg(pl.col("amount").sum())
    lakehouse.write_table(by_region, "dbo.sales_by_region")     # a Delta table in OneLake
    
  6. The notebook saves itself a second or two after each change. Ctrl+S saves right away. Rename it by clicking its name in the breadcrumb at the top.

Create > Notebook from a template (Preview) starts from a template instead. Pick a group or search, answer a few questions (the tables, the columns that identify a row, the table to write), check the cells it will write, and the notebook opens. The cells are plain code from a fixed template, nothing generated by AI, and they read and write through the lakehouse module, so the notebook runs here and in Fabric. The wizard also saves the columns that identify a row of each table it writes in the notebook, and Prove uses them to match rows.

Group Template What the notebook does
Load data Load a file into a table Reads one CSV, Parquet or JSON file under Files/, checks its keys and writes a table
Load data Load a folder of files Reads every file of one type directly in a folder, adds source_file and loaded_at to each row and writes one table. A proof ignores loaded_at
Load data Incremental load with a watermark Appends only the rows whose watermark column (a date, time or ID that only grows) is higher than the highest already in the target, reading only that column of the target. A row that arrives late with a lower value isn't picked up
Load data Flatten a nested JSON file Reads a JSON file under Files/ and turns each nested object into columns named after its path (customer.name becomes customer_name); a name that would clash, even only by case, stops the run. Lists stay as list columns
Clean and check Clean a table Keeps columns, drops rows with no key and duplicate keys
Clean and check Keep the latest row per key Keeps each key's row with the highest value in a column you name (an empty value counts as oldest). Two newest rows with the same value, or a key whose rows all have no value, stop the run, because either could be kept
Clean and check Profile a table One row per column: type, rows, empty values and their share, distinct values, and the lowest and highest value as text. Replaces the last profile, and can't write to the table it profiles
Clean and check Standardize names and types Renames columns to snake_case, trims text, and turns the columns you name into dates or numbers. A value that can't be read stops the run, so nothing is quietly lost
Clean and check Data quality checks Checks required columns, unique keys, allowed values (status: open|closed) and ranges (amount: 0..1000000). Rows that pass go to one table; rows that fail go to a rejects table with a reason
Model Join and aggregate Joins two tables on a column and groups by columns
Model Update a dimension in place (SCD type 1) Upsert: source rows replace the dimension's rows with the same key, new keys are added, and keys no longer in the source stay. No history. Rewrites the dimension as a whole
Model Keep a dimension's history (SCD type 2) When a tracked column changes (every non-key column when you name none), closes the current row (valid_to, is_current false) and adds the next version. A change to an untracked column alone updates the current row in place, without a new version. New keys start at version 1; keys no longer in the source stay current. valid_from and valid_to are the run's time in UTC, so a proof matches rows by key and version and leaves those two out. A tracked column the dimension doesn't have yet stops the run. Rewrites the dimension as a whole
Model Date dimension One row per day between two dates, with year, quarter, month, ISO week, weekday, weekend, and a fiscal year named by the calendar year it ends in
Model Daily snapshot Appends today's rows of a table to a history table with a snapshot_date (UTC). A second run on the same day writes nothing, so a retry can't double a day. It can't write to the table it reads
Compare Reconcile two tables Compares row counts, keys on one side only and column totals; the run fails when they differ, so a schedule stops. Writes nothing
Orchestrate Run notebooks in order Runs other notebooks one after another with notebookutils.notebook.runMultiple, each only after the one before succeeds, with retries. Writes nothing itself

Notebooks are .ipynb files in %LOCALAPPDATA%\FabricDesktop\notebooks. They stay on your PC until you publish them.

Each cell keeps a stable id (the standard id of notebook format 4.5) through edits, moves and saves; a copied cell gets its own. Comparisons and run receipts use it to point at a cell after the notebook changes. When you save a notebook that came from Fabric, Jupyter, VS Code or Colab, what KratosForge doesn't use is kept as it was: a Fabric environment and default lakehouse, the notebook's kernel, widget state, and other tools' cell settings. A cell you didn't change stays exactly as it was in the file, with its outputs, execution count and pasted images; a cell you changed keeps its pasted images while its text still shows them, and drops the outputs of its old code. KratosForge doesn't write its own outputs into the file, and it no longer strips outputs another tool saved there: a team that keeps outputs out of Git strips them before committing, with nbstripout for example. Saving a notebook you didn't change leaves the file byte for byte as it was, and a save writes the file the way it was written (its indent, line endings, key order and final newline), so Git shows only the cells you changed. A file without cell ids, or with empty or repeated ones, gets ids the first time you change it.

The lakehouse module#

from fabric_desktop import lakehouse is the notebook's way to the attached lakehouse.

Call What it does
lakehouse.read_csv(path), read_parquet(path), read_json(path) Read a file. Files/... paths read from the attached lakehouse; any other path is a file on this PC. Returns a Polars DataFrame.
lakehouse.read_table("schema.table") Read a Delta table. The schema defaults to dbo.
lakehouse.write_table(df, "schema.table", mode="overwrite") Write a Delta table. mode is "overwrite" or "append". While it writes, it holds the table's write lease, a small file in the lakehouse's Files/_fabric_desktop/leases/. If another notebook, job, metadata run or agent is writing the table, it waits up to 90 seconds, then stops with who is writing it (agent.md). When OneLake throttles (HTTP 429) a lease, a file upload or a delete, the write waits and tries again, since OneLake did nothing; a refused write says what didn't happen, the status and OneLake's error code, with the path inside the lakehouse. df can also be a stream of batches (a RecordBatchReader or DuckDB's fetch_record_batch), written as one commit without holding it all in memory. In a notebook that writes here, then uploads (the default), it returns at once and the upload runs in the background; the cell ends when its writes are in OneLake (Writing to OneLake). A write that fails fails the cell at its end, after the rest of the cell has run; a notebook set to write straight to OneLake stops at the failed write instead. An overwrite of the same rows uploads nothing. In Fabric, a stream is written batch by batch too. Column types Delta can't hold are written as Fabric reads them, as a Local data project writes them: unsigned integers as the next larger signed type (UInt64 as DECIMAL(20, 0)) and float16 as float. A TIME, an INTERVAL, a decimal of more than 38 digits, or a column that is NULL in every row (with no type) stops the write with a message saying how to cast it. When you append, a column that is NULL in every row takes the table's type for that column. An append, or an overwrite that keeps the table's schema (schema_mode=None or "merge"), never changes values to fit the table's column types: a number with a fraction into a whole-number column, a decimal into a whole-number or floating-point column, a bigint into a float or double column, an int into a float column, a double into a float column, a timestamp into a date column, or text, true/false and numbers into each other stop the write before anything is uploaded, naming each column. A wider type that holds every value exactly still writes: a smaller whole number into a bigger one (an int into a bigint), a tinyint or smallint into a float or double, an int into a double, a float into a double, a date into a timestamp. A whole number too big for its column stops the write. A timestamp without a time zone stops the write with a message naming the column, because Delta would store it in a form Fabric can't read; give it a time zone first (.dt.replace_time_zone("UTC") in Polars). Every other type is written as it is.
lakehouse.sql("SELECT ...") Run Spark SQL over the attached lakehouse's tables, on this PC, and return a Polars DataFrame.
lakehouse.has_schemas() False when the attached lakehouse was created without schemas.

Table names work as they do in Fabric: table, schema.table, or either with the lakehouse's name in front (Sales_Lakehouse.dbo.orders). A lakehouse created without schemas has only dbo, so a name such as tpch.region fails there, in Fabric too; use tpch_region instead, or check lakehouse.has_schemas() to pick the name.

Every write:

  • is checked against the Fabric-safe Delta profile (reader version 1, writer version 2, classic checkpoints, no deletion vectors or column mapping), so the SQL analytics endpoint and Direct Lake can read it. An existing table outside the profile (for example one where Fabric Spark turned on deletion vectors) is refused before anything is written, so the table is left exactly as it was;
  • writes the data files first and the Delta log last, so Fabric never sees a half-written version;
  • shows in Monitor as a notebook write, with rows, mode and Delta version.

A table Fabric hasn't seen before can show under Unidentified in the lakehouse until you refresh the lakehouse in Fabric.

Tables managed by the metadata framework can't be written from a notebook; you'll get an error. Use a scratch_ table name for experiments next to managed tables.

Fabric notebook code on this PC#

Most notebooks written for Fabric run here unchanged.

spark is ready in every cell. It is DuckDB's PySpark-compatible API, wired to the attached lakehouse. There's no Spark cluster; everything runs on this PC.

df = spark.read.table("dbo.sales")
df = spark.sql("SELECT region, SUM(amount) AS total FROM sales GROUP BY region")
raw = spark.read.csv("Files/raw/sales.csv", header=True)
df.write.mode("overwrite").saveAsTable("dbo.sales_by_region")
df.createOrReplaceTempView("v_sales")
from pyspark.sql import functions as F
  • spark.read.csv/parquet/json/load("Files/..."), spark.read.table, spark.sql, saveAsTable, temp views and pyspark.sql.functions work, and so do spark.conf and most DataFrame methods. Spark on this PC lists which.
  • %%sql cells use the same session, so they see temp views. CREATE TABLE ... AS SELECT and INSERT INTO (from a SELECT or VALUES) write lakehouse tables, and a later read sees the table as it is after the write, as in Spark. As in Fabric, CREATE TABLE stops if the table already exists (IF NOT EXISTS leaves it as it is); use CREATE OR REPLACE TABLE or INSERT OVERWRITE to replace it. DROP TABLE and TRUNCATE TABLE on a lakehouse table run in Fabric, and the cell says so; to empty a table here, overwrite it with no rows (spark.table(name).limit(0).write.mode("overwrite").saveAsTable(name)). DROP TABLE IF EXISTS of a table that isn't there does nothing, and DROP TABLE of a temp view drops the view, as in Spark.
  • Writing tables follows Delta's rules, as in Fabric. An overwrite or append whose columns don't match the table, or that would change a column's type (decimals into a whole-number column, numbers into a text column), stops with nothing written, with or without mergeSchema. A narrower type of the same kind, such as INT into a BIGINT column, still writes. Add .option("overwriteSchema", "true") to an overwrite to replace the schema, or .option("mergeSchema", "true") to add new columns; mergeSchema never changes an existing column's type. insertInto writes to an existing table, matches columns by position, and appends unless you pass overwrite=True; SQL INSERT matches by position too. INSERT and insertInto cast their values to the table's column types, as Spark does, when every value comes through the cast unchanged (the literal 1.0, a decimal, into a DOUBLE column); a value that would change, such as 2.75 into a whole-number column, stops the write with nothing written. MERGE INTO (and DeltaTable.merge) does the same for a source column it copies as it is (INSERT *, UPDATE SET *, SET t.v = s.v): a value that would change stops the MERGE with nothing changed.
  • Writer options: overwriteSchema, mergeSchema and, for CSV files, header are honored. optimizeWrite, maxRecordsPerFile and compression only change file layout and are skipped with a note. Any other option stops the cell before anything is written. A Parquet or CSV file written to a path on this PC follows the save mode as in Spark: by default a file that is already there stops the cell, ignore leaves it, overwrite replaces it, and append stops the cell, since the file can't take more rows and would be replaced; append to a lakehouse table instead. In particular, replaceWhere, partitionOverwriteMode, INSERT ... PARTITION and INSERT ... REPLACE WHERE replace part of a table, and ignoring them would replace all of it, so they run in Fabric only.
  • Reading CSV follows Spark's options. Every column is text unless you pass inferSchema=True, and header is false unless you set it, as in Spark. sep, quote, escape, comment, nullValue and UTF-8 encoding are honored; with a schema, mode FAILFAST and DROPMALFORMED work too. Any other option, another encoding, or a mode without a schema stops the cell with a message, and Runs on says so before you run. option("path", ...) works with load() and save() as in Spark; with saveAsTable or insertInto it would make an external table, so it is refused.
  • Reading JSON and Parquet follows Spark's options too. For JSON, multiLine is honored (false reads JSON Lines, true reads one document or array per file), as are UTF-8 encoding, mode PERMISSIVE (a malformed line is a row of nulls) and FAILFAST (a malformed line stops the read). Without multiLine, this PC reads both JSON Lines and whole-file documents, where Spark needs multiLine=True for the second. For Parquet, mergeSchema reads every file's columns by name, and datetimeRebaseMode and int96RebaseMode are taken as CORRECTED. DROPMALFORMED for JSON, PERMISSIVE with multiLine, another rebase mode and any other option (such as dateFormat, primitivesAsString, pathGlobFilter or recursiveFileLookup) stop the cell with a message, and Runs on says so before you run.
  • Casts and dates answer as in Spark. Dividing a column by zero gives NULL. Text that isn't a date or timestamp gives NULL in cast, to_date and to_timestamp, instead of stopping the query. to_date(text, format) reads the text with the format it's given, so to_date('2026-03-02', 'yyyy-MM-dd HH:mm:ss') is NULL, as in Spark. A timestamp cast to a whole number gives the seconds since 1970 (UTC), and a number cast to a timestamp is read as those seconds. In spark.sql and the DataFrame API (select, withColumn, agg, selectExpr, F.expr), decimal +, -, *, /, sum and avg give Spark's result types and exact values, rounded half up (decimal(10,2) / decimal(10,2) is decimal(23,13), avg adds 4 to the precision and scale, sum adds 10 to the precision), and a sum of whole numbers written to a table is stored as bigint, also inside a struct, list or map, as in Spark.
  • read.schema(...) takes a StructType. CSV columns get its names and types by position; Parquet and JSON columns are matched by name. A value that doesn't fit the type becomes null, as in Spark's default mode. A schema on a table, a Delta path or text files stops the cell.
  • Spark SQL built-ins DuckDB lacks are written to give Spark's answer, in spark.sql, %%sql and the DuckDB engine's Databricks SQL: date parts of text (hour('2009-07-30 12:58:59'), quarter, weekday, date_trunc, trunc), timestamp_seconds/_millis/_micros, to_timestamp_ntz, try_to_timestamp, make_timestamp_ntz, make_dt_interval, from_utc_timestamp and to_utc_timestamp; try_add, try_subtract, try_multiply, try_sum, try_avg; any, some, every, std, first_value, last_value, skewness and kurtosis (Spark's population formulas), approx_percentile (a value from the column, as Spark's); isnull, isnotnull, nanvl, e, expm1, log1p, hypot, csc, sec, rint, sign (a double), bround (half-even, a decimal stays a decimal), width_bucket, bit_get, shiftrightunsigned, crc32; substring_index, btrim, elt, find_in_set, overlay, regexp_substr, octet_length, mask, luhn_check, format_string/printf, typeof (Spark's type names); array_repeat, array_remove (keeps NULLs), get, cardinality, arrays_zip and a lambda that returns (y, x) (fields named as in Spark), map_zip_with; explode_outer, posexplode_outer, inline, inline_outer, stack and json_tuple in the select list; to_number, try_to_number, to_char and to_varchar with Spark's number formats (upper or lower case); extract, date_part, to_unix_timestamp and parse_url; to_csv, from_csv (no quoted values), try_to_binary, assert_true, bitmap_construct_agg, bitmap_or_agg, bitmap_count and binary literals written X '1010'; tumbling time windows, GROUP BY window(time, '5 minutes') with window.start, window.end and window_time(window) (counted from 1970 in UTC, as Spark's; a row whose time is NULL is skipped); grouping_id() with no arguments, and rank(x), dense_rank(x), percent_rank(x) (Spark ignores the argument). Functions that can't give Spark's answer here stop the cell by name with a message: sketches (hll_*, count_min_sketch), histogram_numeric, XPath, AES, sentences, make_ym_interval, schema_of_csv, sliding windows (window with a slide or start time) and session_window. Spark functions on this PC lists every built-in.
  • Everyday PySpark beyond DuckDB's own API is added by KratosForge, each written as the Spark SQL it stands for and translated, so it means what it means in Spark:
    • Windows: from pyspark.sql.window import Window, Window.partitionBy(...).orderBy(...), rowsBetween/rangeBetween with Window.unboundedPreceding, currentRow and unboundedFollowing, and .over(w) on row_number, rank, dense_rank, percent_rank, cume_dist, ntile, lag, lead and any aggregate. Sort order and null placement follow Spark (asc puts nulls first, desc last).
    • Aggregates: df.agg(...) (columns or a {"column": "sum"} dict), df.select(F.max("x")) over the whole frame, F.count("*"), countDistinct/count_distinct, sumDistinct, collect_set, max_by, min_by, percentile_approx, kurtosis, and groupBy(...).pivot(column, [values]) with sum, avg, min, max, count or agg (one column per value; with several aggregates, value_alias).
    • Functions: explode, explode_outer, size, element_at, current_timestamp (UTC, as in Fabric), date_format (Spark's patterns, like yyyy-MM-dd HH:mm), date_add, date_sub, datediff, months_between, trunc, next_day, from_unixtime, unix_timestamp, from_utc_timestamp, to_utc_timestamp, get_json_object, to_json, sha1, md5, sha2 (256 bits), uuid, nanvl, format_number (half-even rounding, as in Spark), monotonically_increasing_id (increasing and unique; Spark's values have gaps, these don't) and F.expr with Spark SQL.
    • hash and xxhash64 give Fabric's numbers, in spark.sql, F.expr, selectExpr, F.hash and F.xxhash64 and in Databricks SQL on the DuckDB engine: Spark's 32-bit Murmur3 and its xxHash64, seed 42, over ints, longs, floats, doubles, decimals, text, binary, dates, timestamps, booleans and arrays of these, checked against Apache Spark 3.5.3. Maps, structs, arrays of arrays and intervals stop the cell by name, and so does Spark SQL in Local data projects, which doesn't go through this translation. They are written in SQL, so they are slower than a built-in hash (about 4 seconds per 100,000 rows for hash).
    • DataFrame: selectExpr, fillna and na.fill (a value fills only columns of its kind, as in Spark), dropna and na.drop (how, thresh, subset), replace and na.replace, describe/summary, sample (without replacement), subtract, unpivot/melt, and joining a DataFrame with itself. repartition, coalesce, persist, checkpoint and hint change how Spark spreads work across a cluster, so on one PC they leave the frame as it is.
    • spark.conf: set, get (with a default), unset and getAll. Values are kept and read back as text, as in Spark, so code that sets spark.sql.shuffle.partitions or V-Order runs unchanged; only spark.sql.session.timeZone changes what the engine does here (it starts as UTC, as in Fabric). spark.sql.sources.partitionOverwriteMode set to dynamic is refused, here, in SparkSession.builder.config and again before any overwrite: tables on this PC have no partitions, so the overwrite would replace the whole table where Fabric replaces only the partitions written.
  • Delta time travel and history read a table as it was, as in Fabric and Databricks, and never change it: spark.read.option("versionAsOf", 3).table("dbo.sales") (or "timestampAsOf", "2026-10-20 13:00:00", in UTC), the same options on spark.read.format("delta").load("Tables/dbo/sales"), SELECT * FROM dbo.sales VERSION AS OF 3, TIMESTAMP AS OF '...' and dbo.sales@v3 in SQL (also on the SQL query page), and lakehouse.read_table("dbo.sales", version=3). DESCRIBE HISTORY dbo.sales, lakehouse.table_history("dbo.sales") and from delta.tables import DeltaTable (forName, forPath, history, detail, toDF) list a table's versions from its Delta log. Reading uses OneLake, so it uses capacity like any other read. RESTORE and the other DeltaTable changes (restoreToVersion, vacuum, optimize) run in Fabric; on this PC, read the old version and overwrite the table with it if you mean to. DeltaTable.merge, update, updateExpr and delete run here (see MERGE, UPDATE and DELETE below). A version removed by VACUUM can't be read.
  • Structured streaming (Preview) runs as trigger(availableNow=True), the incremental-load kind: each run takes what arrived since the last one, writes it, and stops. spark.readStream.table("dbo.bronze") (or format("delta").load("Tables/...")) takes the rows appended since the version it last read; a commit that updated or deleted rows stops the stream unless you set skipChangeCommits, which skips that commit whole, and OPTIMIZE commits are passed over, as in Fabric. spark.readStream.format("csv"|"json"|"parquet").load("Files/landing/") takes files it hasn't seen. writeStream writes to a lakehouse table (toTable, appended), foreachBatch, console or memory, and needs checkpointLocation, which moves on only after the write succeeds. Checkpoints at lakehouse paths are kept on this PC, apart from Fabric's at the same path, so a stream run here and in Fabric each keep their own place. Other triggers run as availableNow here and say so; continuous triggers, outputMode("complete") and outputMode("update") (they keep a running result), joins of two streams, Kafka or Event Hubs sources and Delta sources with deletion vectors run in Fabric. Writes go to OneLake like any table write, so they use capacity.
  • MERGE INTO (Preview). spark.sql("MERGE INTO ..."), a %%sql cell, %sql and DeltaTable.forName(...).merge(...) change a table of the attached lakehouse in one Delta commit, as in Fabric. Supported clauses: WHEN MATCHED [AND ...] THEN UPDATE SET ... | UPDATE SET * | DELETE, WHEN NOT MATCHED [BY TARGET] [AND ...] THEN INSERT (...) VALUES (...) | INSERT *, and WHEN NOT MATCHED BY SOURCE [AND ...] THEN UPDATE SET ... | DELETE. The table can be named table, schema.table or with the attached lakehouse's name in front. The source can be a temp view, a lakehouse table or a query. It returns Spark's counts (num_affected_rows, num_updated_rows, num_deleted_rows, num_inserted_rows). Two source rows that match the same table row stop the MERGE before anything changes, as Spark does (unless the only WHEN MATCHED clause is a plain DELETE, which Spark allows too). A MERGE must be the only statement in its spark.sql call. A table with features this PC can't write safely for Fabric (deletion vectors, column mapping) is left alone. The table is checked before the MERGE; if the MERGE itself took the table outside that profile, the rows are already committed, so it is only noted in the log. Like Fabric, a notebook MERGE asks no confirmation, even when it deletes every row (WHEN NOT MATCHED BY SOURCE THEN DELETE with an empty source). In a proof, the MERGE changes the proof's own copy, never the shared table, on this PC and in Fabric (see Spark notebooks). These stay in Fabric: a MERGE into another lakehouse (such as a Data mesh template's keys MERGE into LH_Keys), schema evolution (withSchemaEvolution, MERGE WITH SCHEMA EVOLUTION, or spark.databricks.delta.schema.autoMerge.enabled set to true, which this PC refuses rather than drop the new columns), and MERGE with Preview features off. On this PC the source is read into memory before the MERGE. A MERGE writes to OneLake, so it uses capacity like any write.
  • UPDATE and DELETE (Preview). spark.sql("UPDATE t SET ... [WHERE ...]"), DELETE FROM t [WHERE ...], the same in a %%sql cell or %sql, and DeltaTable.forName(...).update(condition, set), updateExpr and delete(condition) change a table of the attached lakehouse in one Delta commit, as in Fabric, and return Spark's num_affected_rows. Runs on and the Run check judge a change against the notebook's own lakehouse even before one is attached, by its three-part name (Sales.dbo.sales) as well as dbo.sales, and skip a spark.sql that is commented out. They follow the MERGE rules above: the attached lakehouse only, Preview features on, the only statement in the spark.sql call, the table's Fabric profile checked first, a proof's own copy in a proof, and no confirmation, even for a DELETE with no WHERE, which empties the table, as in Fabric. To undo a change, read the version before it (SELECT * FROM t VERSION AS OF n, with n from DESCRIBE HISTORY t) and overwrite the table with it. A condition or value with a subquery (WHERE id IN (SELECT ...)) isn't supported on this PC; use MERGE for that. An UPDATE or DELETE writes to OneLake, so it uses capacity like any write.
  • Not available on this PC: RDDs, UDFs, continuous streams and Kafka or Event Hubs sources, Scala and R cells, and DROP TABLE or TRUNCATE TABLE on a lakehouse table in SQL. A notebook that uses them runs in Fabric only (see Where a notebook runs).
  • Pinned against engine upgrades. the local Spark compatibility tests checks the answers of DuckDB's own PySpark calls and of the everyday calls KratosForge adds on top (windows, agg, explode, fillna, pivot and the like), so a DuckDB upgrade that changes one fails a test before it reaches a notebook.

notebookutils (and mssparkutils) cover the areas below. Rows marked Preview read Fabric live as you and haven't been run on a tenant yet.

Area What works here
fs ls, head, put, append, cp, fastcp (the same copy as cp, and like Fabric's it copies a folder unless recurse=False), mv, rm, mkdirs, exists, over the attached lakehouse and local file: paths. Each ls entry has name, path, size, isDir, isFile and modifyTime (milliseconds since 1970, UTC; Databricks' modificationTime works too). As in Fabric, ls of a file lists just that file, exists("Files") and exists("Tables") are true, head reads only the first maxBytes of a file rather than downloading all of it, and mkdirs creates the lakehouse folder at once, so exists and ls find it before any file is written into it
notebook run, exit, runMultiple and validateDAG, against the notebooks on this PC. As in Fabric, run returns the exit value as a string and stops the other notebook with a TimeoutError after timeout_seconds (90 unless you pass another). The timeout lands between Python steps, so a single long call such as time.sleep(4) finishes before it stops (a 1 second timeout ends at 4 seconds); a DuckDB query is asked to stop at once. runMultiple runs one notebook at a time, passes each activity's args, runs it after its dependencies, honors retry, timeoutPerCellInSeconds and the DAG's timeoutInSeconds (activities that hadn't started when it ran out are skipped), and skips an activity whose dependency failed; when any activity fails it raises after all have run, with every result on the error's results. concurrency doesn't apply, because the notebooks run one at a time. A notebook run inside another can nest 5 deep, so a notebook that runs itself stops. workspace (another workspace's notebook) runs in Fabric only.
credentials getToken, and getSecret from Azure Key Vault as you (needs the Key Vault Secrets User role and the Azure Key Vault permission). The vault is a name or an https://<name>.vault.azure.net URL; any other host is refused, so your Key Vault token goes only to Key Vault. Key Vaults in the US Government and China clouds aren't supported: they need a sign-in to that cloud. isValidToken says whether a token hasn't expired yet (it reads only the expiry)
runtime.context Works; isLocal and isForInteractive are true here, and currentNotebookId is empty because a notebook on this PC isn't a Fabric item
notebook items (Preview) get, list and getDefinition read Fabric notebook items as you (the workspace defaults to the attached lakehouse's; getDefinition returns the ipynb text). create, update, updateDefinition and delete run in Fabric only: on this PC, use Publish to OneLake, which shows what it replaces first
session restartPython() (and stop()) stop the cell and restart Python, clearing variables, as dbutils.library.restartPython() does
lakehouse (Preview) get, getWithProperties, list and listTables, read from Fabric as you; the workspace defaults to the attached lakehouse's, and get() with no name returns the attached lakehouse. create, update, delete and loadTable run in Fabric only: on this PC, create lakehouses in Workspaces or Platform setup, where the change is confirmed first. As in Fabric, listTables doesn't list lakehouses with schemas
warehouse, connections Fabric only. Using them stops the cell with what to do instead: open a warehouse from Workspaces to query it on the Warehouse page, and read secrets with credentials.getSecret from Azure Key Vault
nbResPath The notebook's resources folder on this PC; cells read its files as builtin/<file> (notebook resources)
udf (Preview) getFunctions(name, workspaceId) reads a User data functions item as you (the workspace defaults to the attached lakehouse's): itemDetails, and functionDetails with each function's parameters, return type and description, read from its code. Calling a function runs it in Fabric on its workspace's capacity, so on this PC the call says so instead; run the notebook in Fabric to call it
variableLibrary getLibrary("VL_Sources") reads the metadata project's source system values (variable library). Any other library, and VL_Sources when there is no metadata project, is read from the attached lakehouse's workspace with its active value set, and the cell says which workspace that was (Fabric reads the notebook's own workspace, so attach a lakehouse there to read the same values); Integer, Number and Boolean variables keep their type. Read only (Preview, not yet run on a tenant)

Databricks dbutils is there too, so notebooks written for Databricks run here unchanged where the same thing exists on this PC. It is a global in every cell, and from databricks.sdk.runtime import dbutils works.

Area What works here
fs ls, head, put, cp, mv, rm, mkdirs, the same as notebookutils.fs. dbfs:/, /dbfs/ and /Volumes/ paths are Databricks storage, which this PC can't reach: use Files/... or a file: path. A bare absolute path like /mnt/raw or /tmp/x is DBFS in Databricks, so it is refused here rather than read as this PC's disk; write file:/mnt/raw for a local folder
notebook run (returns the exit value as a string, as in Databricks) and exit. Arguments passed to run are what the child notebook's widgets return. entry_point...getContext() gives notebookPath, userName and tags
widgets text, dropdown, combobox, multiselect, get, getAll, getArgument, remove, removeAll. A widget's value is the argument the run passed, else its default
secrets get, getBytes and list, where the scope is an Azure Key Vault name (as with Key Vault backed scopes), read as you with the Key Vault Secrets User role. Databricks-backed scopes live in Databricks and can't be read here. Secret values are hidden in Variables
jobs.taskValues set and get. In notebookutils.notebook.runMultiple, an activity reads what its upstream activities set, by activity name. Run by hand, get returns debugValue, as in Databricks
library restartPython() stops the cell and restarts Python, clearing variables. Installing libraries isn't possible here, because the engine's packages are fixed
data summarize(df) shows a summary of the data frame

Fabric has no dbutils, so Where a notebook runs says a notebook that uses it runs on this PC only; in Fabric, use notebookutils.

Paths can be written the Fabric way: Files/..., /lakehouse/default/Files/..., or the attached lakehouse's abfss:// path.

fs changes follow Fabric's rules: rm removes a folder that isn't empty only with recurse=True; Tables/ can be read but not changed through fs (write tables with write_table or saveAsTable); mv keeps the source until the copy has every file at its size; and a run that can't write the lakehouse (an external AI tool's run, or a proof) can't change files either.

pandas is there as in Fabric: import pandas as pd, df.toPandas(), and pandas data frames show as tables and can be written with lakehouse.write_table. It's pandas 2, like Fabric's runtimes. A named index (a groupby or set_index result) shows as leading columns, with _index added when a column has the same name, multi-level columns show joined with _ (v_sum), and a repeated column name shows with _2, _3 added. Writing a pandas frame leaves its index out, as spark.createDataFrame does in Fabric, so call reset_index() first to keep groupby keys in the table.

Chart libraries plotly, bokeh, seaborn and altair ship with the app too, next to matplotlib, so chart code from Fabric and Databricks notebooks imports here. plotly, seaborn and matplotlib charts draw in the cell. bokeh's show(p) draws in the cell too, with bokeh's JavaScript included so nothing is fetched, instead of writing a file and opening your browser. Call it from the cell itself: from a thread the cell starts, it says so rather than opening a browser. Altair charts draw in the cell too (Preview), whether a chart is the cell's last line, passed to display(), or chart.show(): KratosForge ships the Vega libraries they need, so nothing is fetched. A chart's data travels with it, so Altair's own 5,000-row limit applies; aggregate first, or alt.data_transformers.disable_max_rows() for a bigger one. plotly's fig.show() draws in the cell as the figure does on a cell's last line (before, it showed nothing), unless the notebook picks another renderer. plotly.offline.plot(fig) writes its file and draws the chart in the cell instead of opening it in a browser, and write_html(..., auto_open=True) writes the file without opening one. A plotly figure goes to the cell as the figure itself, and KratosForge reads plotly.js (about 5 MB) once from the engine's own plotly, rather than sending a copy with every chart, so a notebook with many charts stays quick. A notebook exported as .ipynb with outputs keeps Altair charts and plotly figures for Jupyter to draw.

Magics: a %%sql cell keeps a query's result in _sqldf, and df = %sql SELECT ... runs one query inside Python (see Notebook magics). %run Other notebook runs another notebook in this one's namespace. %pip install installs into the notebook's own environment when notebooks run in their own process (see Notebook magics). %%configure is checked and explained, not applied (see Notebook magics).

Running cells#

Do this How
Run a cell and move to the next Shift+Enter
Run a cell and stay Ctrl+Enter
Run a cell and add one below Alt+Enter
Run everything Run all (Home or Run tab)
Run the cells above, or this one and below Run tab: Run all above, Run cell and below
Stop the running cell Cancel. Variables from earlier cells are kept.
Start fresh Restart kernel (clears all variables), or Restart and run all

Printed output shows while a cell runs. A cell shows up to 1,000,000 characters of printed output; past that it shows an Output truncated line with the path of a text file, in your temp folder, holding everything it printed up to 100 million characters. The file is deleted when the cell's output is cleared, when you restart the kernel, and when Stop ends a notebook's own process. Anything left after a crash is cleaned up when the app next starts. Tables, charts and HTML stop showing after 16 MB per run, with a line saying so. An error always shows: its message keeps its first 200,000 characters and its traceback its last 200,000, where the error itself is, each with a line saying so when cut. An ipywidgets Output has the same limits, counted from its last clear_output(), without the file. Code stuck inside a library call can't always be interrupted; the app then offers Restart kernel.

Settings > Preview features > Run notebooks in their own process (Preview) runs cells in a Python process of their own instead of inside the app's engine. Then Restart kernel on a stuck cell ends only that process and any processes its cells started (including ones that started their own session, like a server), a crash in a library ends only that process (the cell says so and the next cell starts a fresh one), and the rest of the app keeps answering meanwhile. Switching it clears variables.

With that setting on, two more Preview settings appear under it.

  • Query progress. While a cell runs a spark query (spark.sql, spark.read, a DataFrame's collect or show), the line under the cell shows how far the query is, the closest this PC has to Fabric's Spark job progress bar. DuckDB reports it for scans of tables and files; a query over a generated range or one that is just starting shows no percentage. Only the cell's own queries show there: a query run by a widget's handler or by a thread the cell started shows no percentage under the cell. There is no Spark UI on this PC, since there are no Spark jobs.
  • Cell time limit. A cell that runs longer is interrupted, and variables are kept. If it doesn't stop within 30 seconds, for example because it's waiting on one long call, its process is ended and variables are cleared. The cell says which happened and offers Run again without the limit. Proofs and side by side use the same limit, and a proof's receipt records the limits in force.
  • Notebook memory limit. If the notebook's process uses more memory than this, it's ended, so one notebook can't slow the whole PC. Variables are cleared and every cell is marked stale. Memory is checked every second, so a sudden spike can briefly go past the limit before it's seen. KratosForge counts private bytes on Windows and resident memory on Linux, for that process and every process its cells start (a subprocess or a multiprocessing pool), added together. A new process already uses about 0.8 GB on Windows before any cell runs, mostly for the data libraries it loads, so a limit under 2 GB leaves the notebook little room.

Your organization can set either limit in the policy file (azure-setup.md); Settings then shows it as set by your organization.

Notebook sessions (Preview)#

Each notebook has a session of its own, like a Fabric or Databricks session. With Run notebooks in their own process on, every notebook you run gets its own Python process: its own variables and its own spark, so cells in several notebooks run at the same time. Opening another notebook while a cell runs leaves it running; open the notebook again to see its live output. Cells you haven't changed keep their last output when you come back, since their session still has the variables they made. Cancel, Restart kernel and Stop act on the open notebook's session only.

With the setting off, cells run inside the app's engine, which has one attached lakehouse and one spark session, so every notebook shares one kernel and one cell runs at a time. Running a cell while another notebook's cell runs says which notebook is busy.

Sessions in the notebook's status bar lists each session: its state, its process and memory, how many cells it has run and when it was last used, with Open and Stop. Stop ends that notebook's process and clears its variables. Two more settings appear with the setting on:

  • Notebooks with a session (default 5). Running one more notebook stops the least recently used idle session and says so. A running session is never stopped to make room.
  • Stop idle sessions after (default never). A session you haven't used for this long, in a notebook you don't have open, is stopped to give back memory, like Fabric's session timeout.

Shared sessions (Preview) work like Fabric's high-concurrency sessions. In Sessions, Share this notebook's session with picks another notebook, which then runs in this notebook's process. Its own session ends first, so its variables are cleared. Notebooks in a shared session share spark, its temp views and spark.conf settings, so a temp view one notebook makes is there for the other. They run one cell at a time: running a cell while another notebook in the session runs one says which notebook is busy. Variables stay each notebook's own.

  • Same lakehouse and environment. As in Fabric, both notebooks need the same default lakehouse and the same environment.
  • Restart in a notebook that joined a session clears only its own variables, and so does restarting Python in one of its cells (dbutils.library.restartPython()). In the notebook whose session it is, Restart starts the session over for every notebook in it, as Stop does.
  • Environments can't be changed for a notebook that joined a session; it uses the session's. %pip install in it installs into that environment.
  • Stop ends the shared session for every notebook in it.
  • Leave gives a notebook a session of its own again, starting with its next cell.
  • Proofs and replays need the notebook's own session, so leave the shared session first.
  • The status bar says Shared session · 2 notebooks while the open notebook is in one. Execution counts are the session's, so they go up across its notebooks.

Notebook environments (Preview)#

An environment adds Python packages to a notebook, like a Fabric Environment item or Databricks notebook-scoped libraries. It needs Run notebooks in their own process. Environment in the notebook's status bar picks the notebook's environment or makes a new one, lists its packages, and installs or removes them. Several notebooks can share one environment.

  • Installing runs pip on this PC after you confirm. It downloads from PyPI, or from the package index this PC's pip is set up for (pip.ini or PIP_INDEX_URL), and nothing from your Fabric sign-in is sent. Give package names and versions (scikit-learn==1.5.2); pip options, URLs and file paths aren't accepted. Packages run with your permissions, so install only ones you trust.
  • The app's own packages always win. An environment's packages come after them, and pip resolves against the exact versions the app ships, so a package that needs a different numpy, pyarrow or Polars is refused instead of installed and broken.
  • Spark packages aren't added. pyspark, delta-spark and databricks-connect are refused: spark here is the app's own, and Databricks Connect needs a process of its own.
  • Changing a running notebook's environment takes effect when you restart its kernel. Packages installed into the environment it already uses can be imported straight away.
  • Your organization can turn installs off (allow_notebook_packages in the policy file, azure-setup.md); notebooks then use the app's packages only.
  • Your organization can name a folder of approved packages (notebook_package_folder, Preview). Installs then come from that folder first, and from PyPI only if allow_pypi_packages isn't false. The environment dialog says where packages come from, and the install log says which source each try used.

Environments are kept on this PC under the app's data folder, in environments\. They aren't published with the notebook: in Fabric, attach a Fabric Environment with the same packages.

Compare with a Fabric Environment item (Preview)#

Before running in Fabric, check that the Fabric Environment item the notebook will use has the same packages as this PC. It's a command, with no screen in the app yet:

fabric-desktop env-drift --workspace <workspace id> --environment <Environment item id> [--notebook <name>] [--json]

It reads the item's published libraries and its Spark runtime with your sign-in, and the libraries and runtime saved in the item but not yet published. All four calls are read-only, and no Spark session starts. It compares them with the app's own packages plus, with --notebook, that notebook's environment, and lists each library as:

  • Missing here: published to the item, not installed on this PC;
  • Different version: on both, at different versions (1.0 and 1.0.0 count as the same, and a version like >=1.4 is met by any version it allows);
  • Only here: in the notebook's environment, not published to the item. Fabric's runtime may still ship it, which the item's libraries don't say.

It also says when the runtime's Python (runtime 1.3 runs Python 3.11, 1.1 and 1.2 run 3.10) isn't the Python this PC's engine runs, and when it doesn't know a runtime's Python. Uploaded .jar, .py and R files are listed as not compared; a wheel is compared by the name and version in its file name. An item you can't read (no access, a wrong id, deleted) gives Couldn't compare, with the reason, and never stops a run. The exit code is 0 for no drift, 1 for drift, and 2 when the item couldn't be read.

When the item has unpublished changes, the report lists what publishing it would add, remove or change, including a runtime change. Fabric runs what's published, so unpublished changes don't count as drift and don't change the exit code. They do show what the next publish brings in. If the unpublished changes can't be read, the report says so and the comparison with the published libraries stands.

Renaming a notebook keeps its session. Scheduled runs and Validate still run in processes of their own and never touch these sessions.

Cell dependencies and stale outputs (Preview)#

View > Dependencies shows under each code cell what it depends on, read from its code: the variables it uses and which cell defined them, the tables and Files/ paths it reads and which cell wrote them, what it writes, and which later cells use it. Names no cell defines are listed, so a typo or a missing import shows before you run. A dependency you know about but the code doesn't show can be declared in the cell's metadata as depends_on (a list of cell ids).

A cell gets a Stale tag when its output may not match the code above it: its code changed since it ran, a cell it depends on is stale or ran again after it, or the kernel restarted. Cells that use exec, %run or from x import * can depend on anything, so they're stale after any change above them. Cells that haven't run aren't counted.

Run > Run stale cells runs the stale cells again, in order. If any of them writes a table or file, installs packages or calls the network, it asks first and lists what each does, and offers to run only the cells before the first one.

Dependencies come from reading the code, not from watching it run. A cell can still depend on something reading can't see (a value read from a file another program changed, a global set inside a function from a library), so Run all remains the way to be sure.

Variable history, watches and hidden state (Preview)#

The Variables pane (View > Variables) has three more parts for cells that run on this PC:

  • Watches. Type an expression, such as len(events) or df["amount"].sum(), and it's shown with its value after every cell, with its last few values so you can see which cell changed it. A watch runs as notebook code in the kernel, after the cell and as part of its run, so Cancel and the cell time limit cover it. Keep watches to reads: one that changes data changes your notebook's state too. Only expressions are accepted (not x = 1), up to 10 per notebook. A watch that takes longer than 2 seconds is paused until you click Resume. The expressions are saved in the notebook file; their values aren't. Proofs and side by side don't run watches, so they can't change what a proof compares.
  • History. For each cell run: the variables it added, changed and removed, with their type and size. Values aren't kept. History stays in memory for the current kernel only; it's cleared when the kernel restarts and isn't saved. Cell numbers are as they were when the cell ran.
  • Hidden state. After a cell runs, KratosForge checks the names it uses against the cells in the notebook (the same reading of the code as Dependencies). If the cell uses a name that no cell defines, or that only a cell further down defines, but the kernel still has it from an earlier run, a warning shows under the cell: the cell works now but will fail in Fabric, in a proof and after a restart. If that name was set by a cell you've since deleted or changed in this session, Insert that cell back above puts its code back. Ignore for this notebook stops the warning for that name and is saved in the notebook file.

None of these run for notebooks that run in Fabric.

Breakpoints and stepping (Preview)#

For cells that run on this PC, with the same Preview setting as watches:

  • Set a breakpoint by clicking a line number (with Line numbers on) or pressing F9 on a line. A red bar marks it. Breakpoints follow their lines as you edit, and they're kept for this session only, not saved in the notebook file.
  • A cell with breakpoints pauses at them whenever it runs, whether you run it alone or with Run all. Debug cell (pause at the first line) in the cell's ... menu pauses before its first line.
  • While paused, the paused line is highlighted and a panel under the cell shows the call stack, that frame's variables (names, types, sizes and short previews; a variable whose name looks like a secret, or whose value is a secret from getSecret, shows as hidden, but a value built from a secret, such as a connection string, isn't hidden, as in watches), and your watches as they are in that frame. Evaluate runs an expression in the paused frame, such as df.shape or n + 1. Like a watch, it runs as notebook code, so keep it to reads.
  • Continue (F5) runs to the next breakpoint, Step over (F10) to the next line, Step into (F11) into a function the cell defines, and Step out (Shift+F11) to the next line after the function returns. Stop cancels the cell like Cancel, keeping variables.
  • Only the cell's own code stops: functions and classes it defines pause wherever the cell calls them. Libraries, functions from earlier cells, %run notebooks and threads the cell starts run at full speed and never pause. A cell running under the debugger has no time limit, because time spent paused counts as running. The memory limit still applies.

Proofs, side by side, Validate and scheduled runs never stop at breakpoints, because they don't run cells from the editor.

Failure replay bundles (Preview)#

When a cell fails on this PC, Save replay bundle under its error saves a file someone else (or you, later) can use to run the notebook again up to that cell, against the same inputs. The dialog shows exactly what goes in before anything is saved:

  • Always included: the code of the cells up to the failed one; each table the cells read, with the Delta version they read; each file under Files/ they read, with its SHA-256; Python, the versions of the packages the cells import, and whether the kernel runs in its own process with which limits; and the error, with anything that looks like a secret and your home folder's path removed.
  • Workspace and lakehouse IDs: included unless you untick them. Untick them to share the bundle outside your organization. Unticked, they're also taken out of the error, the traceback, the notes and the cells' code: OneLake addresses become abfss://<workspace>@onelake.dfs.fabric.microsoft.com/<lakehouse>/... and any other ID becomes <id>. If the code had them, put your own back before the replay reaches those cells. The bundle still has the lakehouse's name.
  • A sample of the input data: off unless you tick it. Up to 1,000 rows of each table, read at the version the cells read. The bundle then holds your data, so share it only with people allowed to see it. Your organization can turn this option off (allow_replay_samples in the policy file).

The bundle is a .zip saved to your Downloads folder as a new file each time (bundle.json, plus samples/ when you include a sample). A table's version is recorded the first time a cell reads it since the kernel started; for a table the notebook writes before reading, it's the version before that write. Code that looks like it holds a secret is removed from the bundle, so a replay may fail there.

A bundle also lists what it can't promise: cells that hadn't run, ran in a different order or ran again after the failure; a file that changed on this PC after a cell read it (it has no SHA-256); and reads that didn't go through lakehouse (read_table, sql, read_csv and the like), which aren't recorded. Replaying a bundle. Create > Open replay bundle lists the bundles in your Downloads folder, or choose a bundle file someone sent you. It opens the bundle's cells as a new notebook, replay, with a banner at the top. Nothing runs until you click Replay to cell N. A replay runs the bundle's code on this PC with your sign-in, so read the cells first when the bundle came from someone else.

  • Replay needs Run notebooks in their own process (Settings > Preview features), and the bundle's lakehouse attached. A bundle saved without workspace and lakehouse IDs replays against the lakehouse you attach; check it's the same one.
  • Replay to cell N starts a fresh kernel process in which every table is read at the bundle's version, and every write goes to a sandbox under Files/_fabric_desktop/proofs/replay-<id>/pc/ in the attached lakehouse, never its tables, as in a proof. Then the cells up to the failed one run as usual, so their output, variables and watches are there to debug. The banner then says whether the cell failed the same way (reproduced), failed with the same kind of error but another message, failed differently or earlier, or didn't fail.
  • Each replay's sandbox stays in the lakehouse's Files after the replay ends, and the notebook remembers it. Delete replay outputs on the banner deletes those folders (it asks first). The lakehouse's own tables aren't touched. Keep as a normal notebook removes the banner, so it asks first when outputs are still there.
  • If a table's version can no longer be read (vacuumed, or its log cleaned up), the banner says so and replay waits for you to choose: the bundle's sample (when it has one) or the table's latest version. Either is marked in the result as not the same input. Files are read as they are now; a file whose SHA-256 differs from the bundle's is listed.
  • The banner also lists how this PC's Python and packages differ from the bundle's.
  • While the replay runs, the kernel runs nothing else: other notebooks' cells wait until you click End replay. Restarting the kernel also ends it. A replay notebook's cells don't run outside a replay, and it can't be proven, run side by side or published, until you click Keep as a normal notebook. After that its cells read and write the lakehouse's tables like any notebook's.

What output looks like:

  • A cell's last expression shows below it. display(x) shows a value mid-cell. A DuckDB relation (duckdb.sql(...)) shows as a table, from its preview, so the query isn't run a second time.

  • displayHTML(html) shows HTML, as in Fabric and Databricks, in the same sandboxed frame as %%html (it can't reach the app or your files).

  • from IPython.display import display, HTML, Markdown, JSON, Image, SVG, clear_output works although IPython isn't installed: KratosForge provides those names. Markdown shows like a Markdown cell, JSON as a tree you can fold, images from bytes or a file on this PC (an image URL or an IFrame shows its address; nothing is fetched). clear_output() clears the cell's output, and clear_output(wait=True) clears it when the next output arrives, for a loop that redraws. (Preview) h = display(obj, display_id=True) returns a handle, and h.update(new) or update_display(new, display_id=...) redraws that output in place, for progress lines that change as a cell runs. An update reaches the outputs of the running cell and of an ipywidgets Output; a cell that already finished keeps what it showed.

  • Widgets (Preview): import ipywidgets works, and interact, interactive, interactive_output, sliders (int, float, range), number and text boxes, checkboxes, toggle buttons, dropdowns, radio buttons, multi-selects, buttons, labels, HTML, progress bars, Output and VBox/HBox draw as controls under the cell. link, dlink, jslink and jsdlink keep two controls in step (in the kernel, which holds every widget), and return a link whose unlink() stops it. dlink and jsdlink copy one way only, from source to target, as in ipywidgets; earlier builds also copied target changes back to the source, so a notebook that relied on that now needs link. A transform pair on link should undo each other: if the source changes while the target is being set, the link raises TraitError ("Broken link") instead of looping. Changing a control runs its handlers (observe, on_click, on_submit, or the interact function) in the kernel, and what they print or display shows in their Output (or under the controls). A handler gets 60 seconds, then it is stopped. One stuck inside a library call (a sleep, a query) can't be stopped: cells and controls wait until it returns, or restart the kernel. Controls also wait while Prove this notebook runs or a replay is open. Controls wait while a cell runs, and after a restart they ask you to run the cell again. KratosForge draws these itself, so a real ipywidgets package isn't used (it needs Jupyter), and widgets built on it (plotly FigureWidget, tqdm.notebook) don't draw. An HTML widget shows in the same sandboxed frame as %%html, and a password box never sends its value back to the screen.

  • Any object with Jupyter's rich views (_repr_mimebundle_, _repr_html_, _repr_markdown_, _repr_json_, _repr_png_, _repr_jpeg_, _repr_svg_) shows its richest one. Bokeh plots show in the cell if Bokeh is installed.

  • Data frames (Spark, Polars, pandas, Arrow, DuckDB) show the first 1,000 rows with three views over the whole result: Table, Chart and Inspect, described below. display(df, summary=True) opens Inspect.

  • Table works on the whole result, not only the first 1,000 rows. Pages hold 100 rows (Previous, Next); Search all rows and clicking a heading search and sort every row, and each heading shows its column type. The kernel keeps the last 20 results; a lakehouse query is read once, the first time you page, search or sort it, and that copy is reused. After a restart, or once 20 newer results have replaced it, the table asks you to run the cell again.

  • Inspect (and display(df, summary=True)) profiles every row of the result, like Databricks' data profile: missing values (NaN counts as missing), an approximate distinct count, and for numbers min, max, mean, standard deviation, quartiles and a histogram; for dates the earliest and latest; for text the five most common values. Infinite values are counted and left out of the number statistics. The first 200 columns are profiled; a result of more than 250,000 rows is profiled from a random sample of 250,000 rows, so Inspect stays quick, and it says so. A column that can't be profiled says why, and the others still show. Until the profile is ready, and after a restart, Inspect shows the summary of the rows shown first and says so.

  • Chart (Preview) charts every row of the result: the engine adds them up, so the chart isn't limited to the rows shown. Pick Bar, Stacked bar, Line, Area, Scatter, Pie, Histogram or Box, the X axis, the values (or a row count) and how to add them up (sum, average, count, max, min), and optionally a Series column to split them by colour. Seven series show, the rest are added up as Other; bar and pie charts keep the 60 largest X values and line charts the first 60; a scatter plot shows up to 5,000 points, sampled evenly. Give it a title if you like. The chart is saved in the cell (by column name), so it's back after you reopen the notebook or run the cell again; Reset goes back to the default. + Chart (Preview) adds another chart of the same result, up to 10 per cell, each with its own settings; its view is named after its title, or Chart 2, Chart 3 and so on. Remove chart takes one away (the first chart stays; use Reset on it). The first chart is saved where it always was, so an older build still shows it.

  • Clean (Preview) is Data Wrangler: add steps (drop, keep or rename columns, change a type, fill or drop missing values, filter rows, remove duplicates, trim spaces, change case, find and replace, split text, sort) and the preview shows what they do to every row of the result, with the changed columns marked and the row count before and after (above 1,000,000 rows the preview uses the first million). Each step is written as a line of Polars code. Add code to notebook puts it in a new cell under this one; nothing changes until you run that cell, which makes a new <name>_clean data frame and leaves the original as it is. The code reads the data frame the cell displayed (display(orders) gives orders; change the name above the steps), and it runs in Fabric and Databricks notebooks that have Polars too. A step that can't run (say, a number fill on a text column) is marked with the reason, and the code stops before it. Values that can't change type become empty.

  • Query profile (Preview), on a result of spark or %%sql, is the local counterpart of the Spark UI's query details. Profile the query runs the query again under DuckDB's profiler and shows its time, rows read, rows returned and peak memory, then each step of the plan with its rows, its time and its share of the total, with the slowest step marked. Hover a step for its filters and columns; Copy as text copies the whole profile. It only reads, but a query over a lakehouse table reads it from OneLake again, which uses capacity, so it runs only when you ask. The steps are DuckDB's, so they don't match Fabric's Spark UI one for one. After a kernel restart, run the cell again first.

    Under the steps, What this profile shows (Preview) notes what the profile measured that a best-practice rule explains, each with About its rule. A note appears only when the numbers show it, and most profiles have none:

    • A scan that read 100,000 rows or more and kept a quarter or less, through a filter that wraps the column in a function, such as year(order_date) = 2026. The engine can't skip data by the column's values then (SQ002).
    • A cross join that made more rows than both its inputs, or a join that made ten times more rows than its larger input (SQ006).

    The rows and shares are measured in that run on this PC; Fabric's Spark may plan the query differently. Professional and Guided guidance add the rule's principle, and Guided its lesson (Learn).

  • Copy puts the rows on the page on the clipboard, tab-separated, ready to paste into Excel.

  • Download (Preview) saves the whole result to your Downloads folder as CSV, Excel (.xlsx, up to 1,048,575 rows) or Parquet. The file is always new (<notebook> result <date time>.csv, then (2) and so on); a file already there is never replaced, and a download that fails leaves nothing behind. In Excel, values that look like formulas (=...) are saved as text, so opening the file never runs them. CSV and Parquet keep every value exactly as it is, for loading into other tools; open a CSV from someone else's data in Excel with care, or download Excel instead. Downloading writes only to your PC; it reads nothing new from OneLake once the result is held.

  • Matplotlib charts show as images. plotly figures, Altair charts and objects with an HTML view (%%html cells) render in a sandboxed frame.

Editing#

  • Cells have line numbers, bracket matching, folding, find in the cell (Ctrl+F), Ctrl+/ to comment, and autocomplete (Ctrl+Space) from the running kernel's variables, Python names, and the attached lakehouse's table names inside strings and %%sql cells. In a %%sql cell, typing a table's alias and a dot (s.) offers that table's columns, as on the SQL page, without running anything. The app keeps the table and column names it last read for each lakehouse (names only, no data), so completion still works offline or signed out; they go with the other cached copies after local_retention_days.
  • Hover a name for its signature and docs, see a call's parameters as you type, and get a red underline on syntax errors. See IntelliSense in notebook cells.
  • Shift+Alt+F formats the cell you're editing (Python in Black's style, %%sql as Format SQL does), and Edit > Format notebook formats every code cell. See Format code in a notebook.
  • Ctrl+H finds and replaces across every cell. See Find and replace in a notebook.
  • Drag a table or file from Explorer > Data items into a cell, or right-click it to load it with Polars, Spark, SQL or pandas. See Drag tables and files into a notebook.
  • Shift+click or Shift+Down selects several cells to run, copy, merge, freeze or delete together, and Ctrl+Shift+Enter runs just the selected text. See Select several cells and run part of a notebook.
  • Each cell has a language picker (Python, Spark SQL, HTML, Markdown) and ... for more actions.
  • Hide a cell's code or output from its toolbar or the View tab.
  • Command mode (press Esc): A and B add a cell above or below, DD deletes, Z undoes a delete, M and Y switch between Markdown and code, C, X and V copy, cut and paste cells, O hides output, Shift+L toggles line numbers, Tab moves on to the next cell (a cell's buttons come just before its editor in Tab order, so Tab from the cell above reaches them), and Enter goes back to editing.

The ribbon has four tabs:

Tab What's on it
Home Run all, Cancel, Runs on, Check (Side by side, Validate, Prove), Add data items, Save, Share (Save a copy, Versions, Export), Open in VS Code, Schedule (Schedule, Recent runs), Publish to OneLake. The buttons under Check and Schedule are also on the Run tab
Edit Add Code or Markdown cells, Move up or down, Split cell, Merge with below, Delete cell, Undo delete, Parameter cell, Freeze, Find and replace (every cell), Format notebook, Clear all outputs
Run Run all, Run cell, Run all above, Run cell and below, Run selected cells, Cancel, Runs on, Restart kernel, Restart and run all, Schedule, Recent runs
View Explorer, Outline (Markdown headings; click to jump), Variables (name, type, size and value of each variable, secrets hidden; click one to display it), collapse or expand all inputs and outputs, line numbers

Run all is the solid button: running is what you do most in a notebook. Publish to OneLake stays on the Home tab with its options arrow.

After a run. When you run two or more cells on this PC, a line under the ribbon says how many ran and how long it took, or how many ran before the run stopped. It then offers the next step from what the run showed, with a button for each: Go to the failed cell when a cell failed, Review warnings (or Review errors) when Validate found some, Save the notebook when there are unsaved changes, and Publish to OneLake when a run of the whole notebook finished with every cell run. It recommends nothing it has no evidence for. Close the line with its x; the next run shows it again.

The notebook's actions are in the command bar (Ctrl+K) too: Run all, Run the selected cell, Restart the kernel and run all, Validate, Save the notebook, Publish to OneLake, Run in Fabric and Go to the failed cell (Validate and Run in Fabric when Preview features are shown). One that can't run just now says why.

A Parameter cell is the cell that pipelines and notebookutils.notebook.run pass values into, as in Fabric.

Parameters and widgets bar (Preview). When a notebook has a parameter cell, or creates Databricks widgets with dbutils.widgets, a bar above the cells shows each value: the parameter cell's name = value lines (text, whole numbers, decimals and True/False) and each widget (text, dropdown, combobox and multiselect). Change a value there to run the notebook with it: when you run cells on this PC, the new values are set right after the parameter cell, as Fabric does with a run's parameters, and dbutils.widgets.get returns them from the start of every cell, including the cell that creates the widget. The notebook's code doesn't change, and the values are kept with the notebook on this PC. Reset to code puts back the values written in the code. A value that doesn't fit (a word where a whole number goes, a choice that isn't in the list) is shown in red and not used. The bar reads only values written as literals; a widget whose name or default is computed isn't listed. Run in Fabric, Side by side and Prove this notebook use the bar's values too: Fabric gets them as the run's parameters, which it sets right after the parameter cell, and the run on this PC sets them as a run on this PC does. A proof's receipt lists the parameters it ran with. Widgets don't apply in Fabric, which has no dbutils. A value shown in red stops those runs before anything is published or started. Schedules and notebook.run use the code's values or the arguments they pass, not the bar's. A frozen cell can't be edited, run or deleted until you unfreeze it, and every run of the notebook skips it, as Fabric does: Run all, schedules, pipeline steps, Validate, Prove, side by side, external tools' runs and notebook.run, runMultiple and %run from another notebook.

Publish to OneLake#

Publish to OneLake saves the notebook as a notebook item in a Fabric workspace, so it shows in Fabric and can run there.

  1. The first time, it asks which workspace (starting from the attached lakehouse's). The choice is saved in the notebook, so later publishes go straight there.
  2. The arrow next to Publish shows where it goes and has Change workspace....
  3. The attached lakehouse stays the notebook's default lakehouse in Fabric, even when it lives in another workspace. Run in Fabric and Schedule use the same workspace.
  4. Later publishes update the same Fabric notebook, found by its item id, so renaming it here or in Fabric doesn't make a second one. A rename here renames the Fabric notebook too; a rename in Fabric is kept. If that notebook was deleted in Fabric, publish updates one with the notebook's name in that workspace, or makes a new one, and says so.

How it is published:

  • A notebook that uses spark or %%sql is published as a Spark notebook, where spark and %%sql are Fabric's own.
  • A notebook that uses fabric_desktop.lakehouse is published as a Fabric Python notebook with a setup cell first. That cell defines the same lakehouse module from libraries Fabric's Python notebooks already have (Polars, deltalake, DuckDB), so the notebook runs there unchanged. Its %%sql cells become lakehouse.sql(...). The setup cell is only in the published copy, not in your notebook.
  • Other notebooks, such as the surrogate key templates, are published as they are, for Spark.

Where a notebook runs#

Runs on in the ribbon picks where Run all runs the notebook. The choice is saved in the notebook.

Choice What happens
This PC Every cell runs in the kernel on your PC. No Fabric job starts; OneLake reads and writes still use some capacity.
Fabric (Preview) Run all publishes the notebook and runs the whole thing on its workspace's Fabric capacity. Single cells can't run in Fabric; switch back to This PC to run one cell. Cell output shows in Fabric, and the bell tells you when it finishes.
Same as Dev (default) Follows the environment picked on the Data mesh pages and where that environment runs.

A note above the cells tells you when a notebook can't run where it is set to, and which cell is the reason:

  • Spark features this PC doesn't have (RDDs, UDFs, continuous or Kafka streams, Scala or R cells, %%sql or spark.sql that MERGEs, UPDATEs or DELETEs in another lakehouse or with Preview features off) mean Fabric only.
  • A notebook with no lakehouse attached, or one that reads a path on your PC like C:\data, means this PC only.

The note has a button to switch when the other place would work.

The check reads each Python cell's code, not only its text, so it finds notebookutils by any name an import or assignment gives it (import notebookutils as nu, from notebookutils import fs, fs = nu.fs), and reads the Spark session's SQL (spark.sql, or .sql on another name for the session, such as s = SparkSession.builder.getOrCreate()) when it's kept in a variable, an f-string (including a name inside it that holds a string), + or .format. Where it can't tell, the result for that place is Unknown, never "runs here": code built at run time (exec, eval, a module imported by a name in a variable), SQL whose text or table is known only at run time (spark.sql(query) with query passed in, f"MERGE INTO {target} ..."), a notebookutils function looked up by a name in a variable, or a cell Python can't read. Unknown doesn't stop a run, a proof or a side-by-side run; Prove is how to find out. Validate, Prove's check, the advice and the risk check list the Unknown cells as warnings. The note above the cells names each Unknown cell for where the notebook runs, with its reason and line, in a grey note of its own; when something also stops the run, the Unknown cells follow the blockers in the amber note.

What this PC's Spark refuses is known to the check too, from the same list the run uses, so Runs on doesn't say "runs on this PC" for a cell that would then stop on its first run here. That covers a write option saveAsTable or insertInto doesn't take (replaceWhere, partitionOverwriteMode, path, or one this PC doesn't know), a table saved as anything but Delta, a read of a format other than csv, json, parquet, text or delta, read.schema() given a DDL string or put on a read of a table, a dynamic partitionOverwriteMode or autoMerge set with spark.conf.set (autoMerge only when the notebook runs a MERGE), DeltaTable.forPath outside Tables/, restoreToVersion, restoreToTimestamp, vacuum and optimize on a DeltaTable, withSchemaEvolution(), and in SQL RESTORE, MERGE WITH SCHEMA EVOLUTION, INSERT ... PARTITION or REPLACE WHERE, MERGE, UPDATE or DELETE with other statements in one spark.sql call, and DROP TABLE or TRUNCATE TABLE of a lakehouse table. A DROP TABLE or TRUNCATE TABLE of a name with no schema (DROP TABLE IF EXISTS sales) is Unknown, because it runs here for a temp view and in Fabric for a lakehouse table, and so is an option or format named only at run time. Validate's clean run doesn't ask you to confirm an Unknown cell first: running it is how to find out.

A cell that runs another notebook by name (%run Helpers, or notebookutils.notebook.run("Helpers")) is checked through that notebook, the way the kernel finds it on this PC: what stops a cell of Helpers, or is Unknown in it, is that cell's, named as "runs Helpers (%run), whose cell 2 ...". Notebooks it runs in turn are read too, up to 5 deep, the most the kernel runs. notebookutils.notebook.runMultiple is followed the same way when it names its notebooks in a list or in a DAG whose every activity gives its path. %run -b setup.py (or a .sql file) is checked through that file in the notebook's Built-in resources, as the kernel runs it. On this PC every notebook it runs uses this notebook's lakehouse, but notebook.run and runMultiple run each one in a session of its own, which in Fabric uses that notebook's own lakehouse: one that reads or writes tables with no lakehouse attached is reported as stopping the run in Fabric, unless the call sets useRootDefaultLakehouse to True, which gives it this notebook's lakehouse (Unknown when that's set only at run time, or is anything but True or False, such as "false" or 0). It's Unknown when a name is known only at run time, Helpers isn't a notebook on this PC, the notebooks run each other in a loop or more than 5 deep, the file isn't a .py or .sql file in Built-in resources, or the cell uses %run -c. In VS Code, nb validate reads the notebook with that name in the same folder as the file, and %run -b files from <name>.resources beside it.

Run in Fabric and schedules (Preview)#

Run in Fabric publishes the notebook, then starts it on the workspace's Fabric capacity with Fabric's job scheduler. The status bar, the bell and Monitor follow it until it finishes. Attach a lakehouse first; the notebook runs in that lakehouse's workspace (or the workspace you publish to).

Schedule opens one dialog for both places:

  • On this PC: Windows Task Scheduler runs the saved notebook in a fresh kernel of its own (not the one open in the app), every code cell in order with its attached lakehouse. Frozen cells are skipped, as Run all skips them, and the run record says how many were. It runs even when the app is closed, as long as the PC is on and you're signed in to Windows. Save your changes first: it runs what's saved.
  • In Fabric: publishes what's on screen and adds a Fabric schedule. It runs on capacity even when your PC is off.

For either, choose Repeat (Every day, Some days of the week, or Every few minutes), the Times of day (24-hour, comma between, for example 06:00, 18:00), the Days, or Minutes between runs, and, for Fabric, the Time zone: every Windows time zone, your PC's first, with a search box (a schedule on this PC runs in the PC's own time zone). The same dialog lists the notebook's schedules; Edit changes one in place, keeping its runs and whether it is paused, and Remove asks first.

A schedule on this PC normally runs only while you're signed in to Windows. Tick Run even when I'm signed out of Windows (Preview) (when adding it, or in Edit) and Windows asks for your Windows password in its own prompt (on a PC with several screens it may open on another one; KratosForge says so while it waits, for up to 5 minutes) and keeps it with the task; KratosForge never sees or stores it. The PC still has to be on. Windows asks again when you change the schedule's times, but not to pause or resume it, and not when KratosForge updates. When your Windows password changes, the schedule says Windows needs your new password with an Enter it link. If your organization doesn't allow runs while signed out (the Log on as a batch job right), Windows refuses and nothing is saved. Reading or writing OneLake uses your saved Fabric sign-in; if it has expired, the run fails and says to sign in again. Your organization can turn this choice off (allow_signed_out_schedules in its policy file); schedules already set that way then say so and can be turned back to run only while you're signed in. All schedules are also in Monitor > KratosForge > Schedules and Monitor > Fabric > Schedules.

Recent runs (Preview)#

Recent runs (Home > Schedule, the Run tab, or Show this notebook's runs in the command bar) opens a panel beside the cells with this notebook's last 50 runs, newest first, like Fabric's Recent runs. It lists:

  • This PC: runs of the notebook's schedules on this PC, both on schedule and from Run now, including runs of a schedule you've since removed. Details shows when the run started and ended, how many cells ran, the result (for a failed run, which cell failed and why), and whether a failure's Teams alert couldn't be sent.
  • Fabric: runs this app started in Fabric for the notebook: Run in Fabric, Prove this notebook, Side by side, and Run now on its Fabric schedule in Monitor > Fabric > Schedules. Once the app has published the notebook, its runs are matched by the Fabric item it was published to, so they stay listed after a rename and a same-named notebook in another workspace isn't mixed in; before that, by name in the notebook's publish workspace. Each says which workspace it ran in. Open in Fabric opens the notebook's page in Fabric, where its run history is.

Each row says when it ran, where, what started it, its status and how long it took. Opening the panel and Refresh read only the two run logs on this PC that Monitor > Runs reads (schedule_runs.jsonl and fabric_runs.jsonl in the app's folder; the first is trimmed to its newest 10,000 runs (at most 4 MB of them) once it passes 8 MB, the second keeps its newest 500) and ask Fabric nothing, so a Fabric run's status is as last checked. While a Fabric run is still going, Refresh status asks Fabric for the status of this notebook's runs still going (no others), as Monitor does, and saves the answer in fabric_runs.jsonl. It starts no job. Nothing else is written.

Not listed: cells you run in the notebook window, and runs a Fabric schedule starts on its own. Those are in Fabric's Monitoring hub, under Monitor. With no runs yet, the panel says how to add a schedule or run the notebook in Fabric.

Side by side (Preview)#

Turn on Side by side in the ribbon and Run all runs the notebook on this PC, then in Fabric, and shows the time of each and whether both wrote the same tables (rows, columns and a checksum of every row). Both runs write your real tables, so it lists the tables it will overwrite and asks first; Prove is the sandboxed way. The TPC-H benchmark notebooks test it at scale. See Side by side: this PC vs Fabric.

Prove this notebook (Preview)#

Prove in the ribbon opens a panel beside the cells. It checks the notebook, then runs it on this PC and in Fabric from the same pinned table versions, with both runs' writes kept in a sandbox folder, and shows whether the results match:

  • Before a run: what blocks a proof (each reason names the cell), warnings such as clock or web calls, the packages on each side, and how results are compared. Change rules sets the columns that identify a row and the tolerances; they're saved in the notebook.
  • While it runs: each step, a link to the Fabric run, and Cancel proof. Other cells wait until it finishes.
  • The result: Same, Differs, Inconclusive or Failed, and each table's result. Click a table to see the rows that differ, side by side, and to verify again under other rules without running anything. Full scorecard shows time, resources and capacity, each marked Measured, Estimate or Not available. Receipt shows the proof's tamper-evident record and saves it to Downloads as an HTML or Markdown report (leaving out your name, locations or row values) or as the receipt file itself.

See How a proof works.

SQL query#

The SQL query tab works like Fabric's. Open it with SQL query on a lakehouse in OneLake or Workspaces, or New SQL query on a lakehouse page.

  1. The Explorer lists the lakehouse's tables. Click a table to run SELECT * FROM <table> LIMIT 100. Click ▸ next to it to see its columns; click a column to type its name where the cursor is. The button in the Explorer's header collapses it to a thin strip, to give the query more room; the choice is kept on this PC. In a window under 900 px wide it starts collapsed until you choose.
  2. Pick the SQL you are writing in the dialect list next to Run (see below), then write it using the names Fabric uses: SELECT * FROM sales, or schema.table for schemas other than dbo.
  3. Run, Ctrl+Enter or F5. Select some text first to run just that.
  4. Results show the first page of rows (1,000 by default), with how many rows there were and how long it took. Next › and ‹ Previous move through the rest without running the query again; Stop ends a query that is still running. See Running SQL queries on this PC for states, limits and what a query may do.
Button What it does
Format SQL Lays out the selection, or the whole query: one clause per line, nested queries and CTEs indented, keywords in capitals. See Format SQL.
Copy Copies the rows on the current page, tab-separated, for pasting into Excel
Export ▾ Saves the full result as CSV or Parquet in your Downloads folder, streamed with progress and Cancel; never replaces a file. See Export
Save as table Writes the full result to the lakehouse as a Delta table you name. If the table already exists, it asks before replacing it
Open in notebook Turns the query into lakehouse.sql(...) in a new notebook (Spark SQL only)
+ or New SQL query Adds a query tab. Double-click a tab to rename it. ×, or Delete on the tab, closes it, asking first when the query has SQL of its own.

How it works: sqlglot translates your Spark SQL to DuckDB SQL, and DuckDB reads only the columns and files it needs from OneLake. Dates and times are worked out in UTC, as in Fabric's Spark, whatever this PC's time zone, so year() and date_format() give the same answer here as in Fabric. Spark SQL that DuckDB SQL can't say exactly is refused with the reason, rather than run in a way that could answer differently from Fabric. Each query runs in a process of its own with a time and memory limit (Settings › Advanced › SQL queries). Queries only read; nothing in the lakehouse changes unless you Save as table. A query that would change a lakehouse table, a file on this PC or Fabric is refused before anything runs, and one that changes only its own session (a temp view) asks first. Query tabs, with their SQL and dialect, are kept per lakehouse between launches.

Dialects#

Each Fabric engine has its own SQL, so each query tab has a dialect. It sets the highlighting, the suggestions, how Format SQL reads the query and which engine the compatibility check uses.

Dialect Runs on this PC?
Spark SQL (Lakehouse), the default Yes, translated to DuckDB. What you write is what a Fabric notebook's %%sql or a lakehouse SQL query takes.
Fabric Warehouse (T-SQL) No. It is highlighted, suggested, formatted and checked here; run it in the Warehouse.
Fabric SQL analytics endpoint (T-SQL) No, as for Warehouse. Lakehouse tables are read-only through the endpoint.
Fabric SQL database (T-SQL) No, as for Warehouse.
DuckDB (this PC) Yes, as written. Use it for DuckDB features; Fabric doesn't run DuckDB SQL.

A query that runs here is not proof that it runs, or gives the same answer, in a Fabric Warehouse or SQL database: DuckDB is a different engine. That's why T-SQL isn't run on this PC.

Compatibility (preview)#

As you type, the query is checked against the engine picked in the dialect list, without running it: things that engine doesn't support are underlined, and the Compatibility panel beside the editor (it opens by itself for an error, a warning or SQL it couldn't verify, or from the chip beside Format SQL) lists every finding with why, what to do, its confidence and its Microsoft source. Export JSON saves the report. See SQL compatibility check.

Editor#

  • Line numbers, current-line highlight, bracket matching, folding (click the arrow in the gutter), and highlighting of keywords, functions, strings, numbers, comments, variables (@name in T-SQL) and operators. Table names the lakehouse has are underlined, so a misspelled table stands out.
  • Suggestions as you type, or Ctrl+Space: keywords and functions for the dialect, the lakehouse's schemas and tables, and the columns of the tables the statement names. After s. where s is an alias or a table, you get that table's columns. Names that need it are quoted for the dialect (`Region Name`, [Region Name] or "Region Name"). Tables come from the list the Explorer already loaded, and a table's columns are read once, the first time a statement names it, so typing doesn't call Fabric. Refresh reads them again.
  • Ctrl+Enter or F5 runs the selection, or everything. Ctrl+S saves the query tabs (they are also saved as you type). Shift+Alt+F formats.
  • Ctrl+F finds, with replace. Ctrl+/ comments or uncomments lines. Tab and Shift+Tab indent. Ctrl+Z and Ctrl+Y undo and redo.
  • More than one cursor: Ctrl+D selects the next match of the selection, Ctrl+click adds a cursor, and Alt+drag selects a rectangle.

Format SQL#

Format SQL uses sqlglot to read the query in the tab's dialect and print it back laid out. It never changes what the query does: before replacing your text it checks that the formatted query reads the same, and that every identifier, string, number, function name and comment is still there. Only keywords, function names and date parts such as 'month' change case. If sqlglot would change anything else (rename a function, drop a comment, read something differently) or can't read the query, your SQL stays as it was and a message says why. Formatting is one step for Ctrl+Z. Comments are kept; a comment can move to the end of the line next to the code it was attached to.

Job files#

For repeatable transforms without a notebook, a job file runs DuckDB SQL or a Polars script and publishes the result. See Job files. From a terminal: fabric-desktop preview job.toml shows the result without writing it, and fabric-desktop run job.toml writes it. With a metadata project open, run refuses a table the project manages and any workspace Test or Prod uses. Monitor > Runs lists each run as a Job run, named after the job.

Need a hand?

Find a fix in troubleshooting, or share a reproducible issue with the community.

Get support ↗Improve this guide on GitHub ↗
Development documentation snapshot: cbf1c74e441de6cb982e7b463591fc6f1a3d2c6b · View source on GitHub ↗

Search documentation

Start typing to search all 115 guides.

Search runs in your browser esc to close