Files
gh-data-goblin-fabric-cli-p…/skills/fabric-cli/scripts
2025-11-29 18:18:03 +08:00
..
2025-11-29 18:18:03 +08:00
2025-11-29 18:18:03 +08:00
2025-11-29 18:18:03 +08:00
2025-11-29 18:18:03 +08:00

Fabric CLI Utility Scripts

Python scripts extending fab CLI with common operations. All scripts use the same path syntax as fab commands.

Path Syntax

All scripts use Fabric path format: Workspace.Workspace/Item.ItemType

# Examples
"Sales.Workspace/Model.SemanticModel"
"Production.Workspace/LH.Lakehouse"
"Dev.Workspace/Report.Report"

Scripts

create_direct_lake_model.py

Create a Direct Lake semantic model from lakehouse tables. This is the recommended approach for querying lakehouse data via DAX.

python3 create_direct_lake_model.py "src.Workspace/LH.Lakehouse" "dest.Workspace/Model.SemanticModel" -t schema.table
python3 create_direct_lake_model.py "Sales.Workspace/SalesLH.Lakehouse" "Sales.Workspace/Sales Model.SemanticModel" -t gold.orders

Arguments:

  • source - Source lakehouse: Workspace.Workspace/Lakehouse.Lakehouse
  • dest - Destination model: Workspace.Workspace/Model.SemanticModel
  • -t, --table - Table in schema.table format (required)

execute_dax.py

Execute DAX queries against semantic models.

python3 execute_dax.py "ws.Workspace/Model.SemanticModel" -q "EVALUATE VALUES('Date'[Year])"
python3 execute_dax.py "Sales.Workspace/Sales Model.SemanticModel" -q "EVALUATE TOPN(10, 'Orders')" --format csv
python3 execute_dax.py "ws.Workspace/Model.SemanticModel" -q "EVALUATE ROW(\"Total\", SUM('Sales'[Amount]))" -o results.json

Options:

  • -q, --query - DAX query (required)
  • -o, --output - Output file
  • --format - Output format: table (default), csv, json
  • --include-nulls - Include null values

export_semantic_model_as_pbip.py

Export semantic model as PBIP (Power BI Project) format.

python3 export_semantic_model_as_pbip.py "ws.Workspace/Model.SemanticModel" -o ./output
python3 export_semantic_model_as_pbip.py "Sales.Workspace/Sales Model.SemanticModel" -o /tmp/exports

Creates complete PBIP structure with TMDL definition and blank report.

download_workspace.py

Download complete workspace with all items and lakehouse files.

python3 download_workspace.py "Sales.Workspace"
python3 download_workspace.py "Production.Workspace" ./backup
python3 download_workspace.py "Dev.Workspace" --no-lakehouse-files

Options:

  • output_dir - Output directory (default: ./workspace_downloads/)
  • --no-lakehouse-files - Skip lakehouse file downloads

Requirements

  • Python 3.10+
  • fab CLI installed and authenticated
  • For lakehouse file downloads: azure-storage-file-datalake, azure-identity