Run code runs a Python function and stores its return value. Use it for calculations, data transformations, or logic the other steps cannot do.
The function
Your code lives in one function called main. Whatever it returns is stored in the variable you pick under Select output variable.
def main(order_total):
return round(order_total * 1.21, 2)
Use Edit code to open a larger editor.
Function parameters mapping
Each parameter of main gets its value from the flow. Under Function parameters mapping, map every parameter to a parameter, variable, or context value. In the example above, order_total would be mapped to the variable holding the order amount.
Technical reference: the Python environment
Code runs in an isolated sandbox with Python 3.12. The standard library is available, plus these packages: cryptography, dateparser, google-cloud-bigquery, google-auth-oauthlib, PyJWT, and requests. Other packages cannot be installed.