Skip to content

Export And Serialization

Helpers for writing Fabric item folders and serializing models to JSON.

fabric_data_pipelines.save_workspace

save_workspace(
    pipelines: Iterable[Pipeline],
    directory: str | Path,
    *,
    prune: bool = False,
) -> list[Path]

Export multiple pipelines into a Fabric workspace folder.

Parameters:

Name Type Description Default
pipelines Iterable[Pipeline]

Pipeline instances to export.

required
directory str | Path

Target folder containing *.DataPipeline/ item folders.

required
prune bool

When True, remove any existing *.DataPipeline/ folders not produced by this run.

False

fabric_data_pipelines.dump_json

dump_json(obj: Any, *, indent: int | None = 2) -> str

Serialize a Fabric model (or nested dict/list) to JSON text.

Parameters:

Name Type Description Default
obj Any

A :class:FabricModel, dict, list, or JSON-serializable value.

required
indent int | None

Indentation passed to :func:json.dumps. Use None for compact output.

2

Returns:

Type Description
str

A JSON string.

fabric_data_pipelines.Expression

Bases: FabricModel

A Fabric expression object {"value": "...", "type": "Expression"}.

Strings that look like Fabric expressions (start with @) or any :class:~fabric_data_pipelines.expressions.Expr may be passed wherever an Expression is expected and will be coerced automatically.

Example::

from fabric_data_pipelines import Expression, expr

Expression(value="@pipeline().parameters.run_date")
Expression.model_validate(expr.parameter("run_date"))

fabric_data_pipelines.FabricModel

Bases: BaseModel

Base model that serializes fields as camelCase Fabric JSON keys.