Skip to main content

Write Python in the Astro Cloud IDE

A Python cell contains a Python function that you can run in isolation or as a dependency in your pipeline. Create Python cells to execute Python as part of your data pipeline.


Create a Python cell

  1. In the Astro UI, select a Workspace and then select Cloud IDE.

  2. Select a project.

  3. On the Pipelines page, click a pipeline name to open the pipeline editor.

  4. Click Add Cell > Python.

  5. Click the cell name and enter a name for the cell.

  6. Add your Python code to the cell body.

Run a Python cell

See Run cells in the Astro Cloud IDE.

Create explicit dependencies for a Python cell

In a Python cell, click Dependencies and select a cell to make it an explicit upstream dependency of your Python cell. When you run your entire pipeline, the Python cell cannot begin running until the selected upstream cell finishes running.

To make a Python cell an upstream dependency for another cell, click Dependencies for the other cell and select the name of your Python cell.

To create data dependencies between Python cells, see Pass data between cells.

View complete code for Python cells

To view your Python cell within the context of an Airflow DAG, click Code. The Airflow DAG includes your Python function as well as all of the code required to run it on Airflow.

All Python cells execute Python using aql.dataframe, which is a function available in the Astro SDK. See Astro SDK documentation.

See also

Was this page helpful?

Sign up for Developer Updates

Get a summary of new Astro features once a month.

You can unsubscribe at any time.
By proceeding you agree to our Privacy Policy, our Website Terms and to receive emails from Astronomer.