Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions docs/notebooks/playground/playground.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
@app.cell(hide_code=True)
async def initialize():
import sys
import marimo as mo

# NOTE: this installs the dependencies for the notebook if run on pyodide
if sys.platform == "emscripten":
Expand All @@ -28,38 +27,40 @@ def run():
import dlt
import requests

@dlt.resource(table_name="users")
def users():
yield requests.get("https://jsonplaceholder.typicode.com/users").json()
@dlt.resource(name="customers")
def fetch_customers():
response = requests.get("https://jaffle-shop.dlthub.com/api/v1/customers?limit=100")
yield response.json()

pipeline = dlt.pipeline(
pipeline_name="users_pipeline",
pipeline_name="customers_pipeline",
destination="duckdb",
dataset_name="raw_data",
dev_mode=True,
)
print(pipeline.run(users()))
load_info = pipeline.run(fetch_customers())
print(load_info)
return (pipeline,)


@app.cell
def view(pipeline):
# NOTE: This line displays the data of the users table in a marimo table
pipeline.dataset().users.df()
# NOTE: This line displays the data of the customers table in a marimo table
pipeline.dataset().customers.df()
return


@app.cell
def connect(pipeline):
# NOTE: This line allows your data to be explored in the marimo datasources which is the third item from the top in the left sidebar
con = pipeline.dataset().ibis()
return
return (con,)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you return (con,) here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think marimo adds this if you are in edit mode

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jinso-o just double check if it's not breaking anything

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's basically marimo's way of saying "make this variable available to other cells and the UI"!



@app.cell(hide_code=True)
def tests(pipeline):
# NOTE: this cell is only needed for testing this notebook on ci
assert pipeline.dataset().users.df().shape[0] == 10
assert pipeline.dataset().customers.df().shape[0] == 100
return


Expand Down
Loading