Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Python Notebook does not respect pipeline input parameter

Hi, I'm encountering an issue when running a Python notebook through a Fabric pipeline. When I run the notebook manually in the workspace, everything works fine: it correctly loads the Excel file fr...
  • AmiGarala's avatar
    1 year ago

    1. Check Notebook Parameter Cell Format
    Your notebook must have a parameter cell defined like this at the top:

    # Parameters
    sheet_name = "Sheet1" # default value
    Fabric uses this cell to inject pipeline parameters. If this is missing or misnamed, the pipeline cannot override it.

    Make sure:

    The variable name (sheet_name) matches exactly with the name used in the pipeline.

    The cell is tagged with "parameters" (Fabric auto-detects this if you're using the right format).

     

    2. Ensure the Pipeline Is Passing the Parameter
    In your pipeline:

    Go to the notebook activity block.

    Click on the "Settings" pane.

    Confirm:

    Input parameter name is sheet_name (case-sensitive match).

    Value is set to Sheet2.

    Optional sanity check: Add a debug cell to your notebook to log it:
    print(f"Using sheet name: {sheet_name}")

     

    3. Double-Check Parameter Mapping in JSON Behind the Scenes (Optional)
    If you're comfortable editing JSON:

    Open the pipeline JSON (if accessible via export or dev mode).

    Look for something like:

    "notebookActivity": {
    "parameters": {
    "sheet_name": "Sheet2"
    }
    }

    4. Avoid Hardcoded Values in Notebook
    Sometimes developers accidentally override the parameter later in the notebook:

    sheet_name = "Sheet1" #  This will override pipeline input
    Make sure this line appears only in the parameter cell and not anywhere else.