Forum Discussion

MangoMagic's avatar
MangoMagic
Regular Visitor
1 year ago
Solved

VS Code Fabric User Data Functions

I was trying to develop Fabric User Data Functions on my local machine as doing it through Fabric portal is very difficult and it takes many minutes to publish / test & debug function after making mi...
  • v-dineshya's avatar
    1 year ago

    Hi MangoMagic ,

    Thank you for reaching out to the Microsoft Community Forum.

     

    You are trying to import "fabric.functions", which is not part of the open-source fabric PyPI package. In Microsoft Fabric, User Defined Functions (UDFs) for the Data Factory or Lakehouse experience are powered through a special runtime in the Fabric service not a publicly installable Python package like fabric.functions.

     

    So when you try to import

     

    import fabric.functions as fn

     

    You are assuming that "fabric.functions" is an importable local module but it's only available in the Microsoft Fabric runtime environment, not on your local machine.


    1. Microsoft Fabric UDFs rely on a specific SDK that is not publicly available via PyPI. It's bundled within the Fabric runtime environment. You cannot run or test these functions locally using the standard Python environment.You must use the Fabric portal or a supported development environment that includes the Fabric runtime.

     

    2. You can test the fabric.functions module locally by creating a sample module with the same interface for testing purposes. Alternatively, use logging and unit tests to validate your logic independently of the Fabric-specific decorators.

     

    Please refer Microsoft document

    Microsoft Fabric documentation - Microsoft Fabric | Microsoft Learn

     

    I hope this information helps. Please do let us know if you have any further queries.

     

    Regards,

    Dinesh