Developer Transformation Guide > Python Transformation > Creating a Python Transformation
  

Creating a Python Transformation

In the Developer tool, you can create a reusable or non-reusable Python transformation.

Creating a Reusable Python Transformation

You can create a reusable Python transformation to use the transformation in multiple mappings. Create a reusable Python transformation in the Developer tool.
    1. In the Object Explorer view, select a project or a folder.
    2. Click File > New > Transformation.
    The New dialog box appears.
    3. Select the Python transformation.
    4. Click Next.
    5. Enter a name for the transformation.
    6. Click Finish.
    The transformation appears in the editor.
    7. In the Overview view, click the New button to add a port to the transformation.
    8. Edit the port to set the name, data type, and precision.
    Use port names as variables in the Python code.
    9. In the Python view, specify the resource files and write the Python code for the transformation.
    10. In the Advanced view, edit the advanced properties for the transformation.

Creating a Non-Reusable Python Transformation

You can create a non-reusable Python transformation to use the transformation in a single mapping. Create a non-reusable Python transformation in the Developer tool.
    1. In a mapping or a mapplet, drag a Python transformation from the mapping palette to the editor.
    The transformation appears in the editor.
    2. In the General tab, edit the transformation name and the description.
    3. In the Ports tab, click the New button to add a port to the transformation.
    4. Edit the port to set the name, data type, and precision.
    Use port names as variables in the Python code.
    5. In the Python tab, specify the resource files and compile the Python code for the transformation.
    6. In the Run-time Linking tab, create run-time links between the Python transformation and an upstream or downstream transformation in the mapping if the ports change at run time.
    7. In the Advanced tab, edit the advanced properties for the transformation.