Code Runner

Code Runner allows the user to use Python code to perform operations.

The output should be stored in a variable called response at the end of Code Runner.

response = "Hello World"

The previous step responses from Data Hub can be used in Code Runner by enclosing the step number (optionally followed by a dot and variable name in case of nested structure) within double curly brackets.

email = {{}}
// Do something here


  • Allowed packages: JSON, datetime, math, re and time

  • Allowed built-in methods: min, max, len, range, all, any, bool, dict, enumerate, filter, float, int, isinstance, list, map, reversed and sum

  • Other than the above-specified packages and built-in methods, no other packages can be imported as Import is restricted.

Use Cases

"response" Variable

Code Runner should have a variable called response which holds the final result. If there is no variable called response, there will be a validation error.

Example 1:

response = {"ids": [1,3,5,6]}


{"ids": [1,3,5,6]}

Example 2:

def check(email):
    if(re.fullmatch(r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b', email)):
        return True
        return False



Import is restricted

Importing other packages/modules is not allowed in Code Runner. If imported, the code will throw an error and will not be executed.


import pandas as pd
data = {"items": ['pen', 'pencil', 'sharpener'], "quantity": [50, 40, 45]}
df = pd.DataFrame(data)
response = df


Execution failed because import found in code

Built-in methods

The usage of built-in methods other than the listed methods is not supported.

Example 1: Using an allowed built-in method

a = [1,2,3,4]
response = min(a)



Example 2: Using a not allowed built-in method

a = [1,2,3,4]
response = type(a)


name 'type' is not defined

If any restricted methods are needed for you, reach out to us with your use case by raising a ticket in the Support Portal.

Execution Time Limit

3 minutes

If the code takes more than that for execution, a timeout occurs and an error is thrown.

Modify Duplicate Previous Step Values

Changing the result of the previous step is restricted in workflows. However, with the help of Code Runner, any previous step from the Data hub can be duplicated and modified. The response of Code Runner can be used where the modified data is needed.

Last updated