Python
Insert custom Python code
This tool is currently in Beta and is still being tested. Want to learn more? Like to provide feedback? Please reach out to support@cascade.io
Code allows for custom Python to be executed against tables and objects inside a Cascade Workflow. One can ingest any number of sources and output any number of objects.
Accessing Objects & Variables
Any source linked to the Code tool is accessible using the sources
dictionary, and objects can be accessed by their index or by their name. For example:
Similarly, workflow variables are available using the variables
dictionary. It's recommended to access variables by their name:
Returning Objects
Cascade allows the return of Table,
Chart
, Json
, or Markdown
objects for use in downstream tools. Objects can be returned as a single object or an array of objects.
Table
To create and return a table, provide a name
and pandas df
attribute to the Table
object.
Chart
To create and return a chart, provide a name
and plotly figure
attribute to the Chart
object.
JSON
To create and return a json, provide a name
and python dict
attribute to the JSON
object.
Markdown
To create and return a json, provide a name
and python dict
attribute to the JSON
object.
Available Libraries
Within the Code tool, the following libraries are accessible by default. Import libraries using import
:
Library
Description
Import
URLlib
URL Encoding/decoding
import urllib
Last updated