What You’ll Learn
- Writing data files into a sandbox with
sbx.files.write()
- Writing executable Python scripts into a sandbox
- Running scripts with
sbx.commands.run()
- Reading generated output files back with
sbx.files.read()
- End-to-end data pipeline inside an isolated sandbox
Prerequisites
This example is available in Python. TypeScript version coming soon.
Code Walkthrough
Upload the CSV dataset directly as a string — no disk I/O on the host:
Upload the analysis script as a multiline Python string:
Run the analysis and capture stdout:
Read back the generated results file:
This pattern works for any file format — JSON, Parquet, images, or binary data. sbx.files.write() accepts both string and bytes content.
Expected Output