Skip to content

Execution Activities

Activities that run notebooks, scripts, dataflows, stored procedures, or child pipelines.

fabric_data_pipelines.Notebook

Bases: Activity

Execute a Fabric (Trident) notebook.

Serializes as Fabric activity type TridentNotebook.

Example::

from fabric_data_pipelines import Notebook

notebook = Notebook(
    name="transform",
    notebook_id="00000000-0000-0000-0000-000000000002",
    workspace_id="00000000-0000-0000-0000-000000000001",
    parameters={"run_date": {"value": "2024-01-01", "type": "string"}},
)

fabric_data_pipelines.Script

Bases: Activity

Execute one or more SQL (or other) scripts against a database.

Example::

from fabric_data_pipelines import Script, ScriptBlock, ExternalReferences, expr

script = Script(
    name="Guard_TryAcquireLock",
    database="JobControl",
    scripts=[
        ScriptBlock(
            text={
                "value": (
                    "EXEC [dbo].[usp_TryAcquireJobLock]\n"
                    f"  @RunId = N'{expr.interp(expr.run_id())}';"
                ),
                "type": "Expression",
            },
            type="Query",
        )
    ],
    script_block_execution_timeout="02:00:00",
    external_references=ExternalReferences(
        connection=expr.library_variable("Demo_ETL_Library_SourceDb")
    ),
)

fabric_data_pipelines.ScriptBlock

Bases: FabricModel

A single script block inside a Script activity.

Fabric stores script text as an Expression object when dynamic content is used, or as a plain string. This class accepts either.

Example::

ScriptBlock(text="SELECT 1", type="Query")
ScriptBlock(
    text={
        "value": "EXEC usp_Lock @RunId = N'@{pipeline().RunId}';",
        "type": "Expression",
    },
    type="Query",
)

fabric_data_pipelines.Dataflow

Bases: Activity

Refresh a Fabric Dataflow Gen2.

Serializes as Fabric activity type RefreshDataFlow.

Example::

from fabric_data_pipelines import Dataflow

dataflow = Dataflow(
    name="refresh_sales",
    dataflow_id="aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
    workspace_id="00000000-0000-0000-0000-000000000001",
)

fabric_data_pipelines.StoredProcedure

Bases: Activity

Execute a SQL Server stored procedure.

Serializes as Fabric activity type SqlServerStoredProcedure.

Example::

from fabric_data_pipelines import StoredProcedure, ExternalReferences

sp = StoredProcedure(
    name="run_merge",
    stored_procedure_name="dbo.usp_MergeSales",
    database="Warehouse",
    stored_procedure_parameters={"RunDate": {"value": "2024-01-01", "type": "String"}},
    external_references=ExternalReferences(connection="..."),
)

fabric_data_pipelines.ExecutePipeline

Bases: Activity

Execute another pipeline as a nested activity.

Example::

from fabric_data_pipelines import ExecutePipeline, PipelineReference

invoke = ExecutePipeline(
    name="Invoke_History_Full_Load",
    pipeline=PipelineReference(reference_name="11111111-1111-1111-1111-111111111111"),
    parameters={"full_load": 1},
    wait_on_completion=True,
)

fabric_data_pipelines.PipelineReference

Bases: FabricModel

Reference to another pipeline by id or name.

Example::

PipelineReference(reference_name="11111111-1111-1111-1111-111111111111")

fabric_data_pipelines.Web

Bases: Activity

Call a REST endpoint via a Fabric connection.

Serializes as Fabric activity type WebActivity. The connection supplies the base URL; relative_url is the path (and query) appended to it.

Example::

from fabric_data_pipelines import Web, ExternalReferences

web = Web(
    name="Call_Orders_API",
    method="GET",
    relative_url="/orders?status=open",
    headers={"Accept": "application/json"},
    http_request_timeout="00:01:40",
    external_references=ExternalReferences(
        connection="00000000-0000-0000-0000-000000000005"
    ),
)