executing-spark
Installation
SKILL.md
Executing Spark Code in Fabric (No Notebook)
Run arbitrary PySpark or Python code on Fabric Spark compute via the Livy API. No notebook artifact is created or persisted; sessions are ephemeral. Full read/write access to lakehouse Delta tables via Spark SQL.
Prerequisites
- Azure CLI authenticated (
az login) - A lakehouse in the target workspace (the Livy session runs against it)
- Fabric capacity (F or trial)
Critical: Authentication
The Livy API requires a token from az account get-access-token --resource https://api.fabric.microsoft.com. Tokens from fab auth do not work for OneLake storage access inside the Spark session.
import subprocess, json