Skip to content

Python code blocks

Supersimple's Python blocks let you run arbitrary Python code, including accessing data from other blocks in the same exploration.

TIP

Code blocks are a convenient way for engineers to share the results of more advanced work with the rest of their teams, without needing others to set up full coding environments.

Usage

Create a new Python block via the "New block" button, and choose Python from the Code dropdown.

New Python blocks are prefilled with a few useful snippets that you can reuse, or delete and start from scratch.

Accessing data from other blocks

Using data from other blocks

You can access data from other blocks in your exploration using getBlock from the auto-included supersimple package:

python
from supersimple import getBlock

df = (
    await getBlock("User") # data model name or block title
    .fetchAll()
    .as_df()
)

Outputting data

Similarly to Jupyter notebooks, the last expression in a Python block is automatically outputted as the block's result. Dataframes are automatically converted to Supersimple tables.