> ## Documentation Index
> Fetch the complete documentation index at: https://docs.runorion.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Orion is a collaborative analytics platform built by Gravity (bygravity.com). It connects to data warehouses, to Looker and dbt for existing business logic, and to a small set of external-context sources, and it lets teams ask questions in natural language to get shared analyses, dashboards, reports, and slide decks. The Connecting Data Sources page is the authoritative list of supported sources. When referencing Orion features, always link to the relevant documentation page. Orion is not open-source; it is a commercial SaaS product accessed at runorion.com.

# Analysis Notebooks

> Inspect and refine the work behind an answer

Orion runs comprehensive analyses in a Python notebook, giving you full visibility into the code behind its queries and transformations. The notebook lets you inspect its SQL or Looker queries, Python cells, and their outputs. Advanced users can optionally edit supported queries and Python cells directly, then have Orion rerun the notebook.

Use it to check a calculation, correct a query, or reuse an analysis. Orion by Gravity captures the notebook during [an analysis](https://docs.runorion.com/chat/running-analyses.md), without a separate save step.

These instructions apply to notebooks in project chat. The [notebook panel on a published dashboard](https://docs.runorion.com/dashboards/publish.md#viewing-the-notebook) is read-only.

In projects using [Warp Drive](https://docs.runorion.com/core-concepts/warp-drive.md#full-analysis-access), notebook execution requires Full Analysis access.

## Open the Notebook

In the conversation, select **Session → Content**, then **Analysis Notebook**. You can also select **View** on the **Analysis Notebook** card below the chat.

The notebook belongs to that conversation. Reopen the conversation to return to its work.

## Inspect Queries and Python

Expand **Data Extractions** to inspect the queries that brought data into the analysis. Depending on the source, these are SQL queries or source-specific requests. Use **Copy query** to review one elsewhere, or **Download CSV** to inspect its extracted rows.

Expand **Notebook Cells** to inspect the Python that transforms those inputs. Each cell retains its code and recorded output. Follow the query and transformation together when checking filters, joins, or calculations.

A chart alone does not show whether the calculation matches your question. Check the source, date range, and business definition before using the result.

## Change the Analysis

Ask Orion in chat when the change concerns business meaning. For example: "Use our approved net revenue definition and compare the last 90 days by region." Explain the intended correction rather than only asking for a different chart.

To change code directly:

1. Expand the relevant query or Python cell
2. Edit the code in its editor
3. Select **Save** in the edited card
4. Read Orion's response and inspect the resulting output

**Save** submits all pending notebook edits together. It sends a request to Orion rather than executing your draft directly. Orion reviews proposed Python edits before applying them and rerunning the notebook. If an edit is rejected, use the explanation to correct it.

Query editing is available for supported, completed extractions. A read-only query can include an explanation of why it cannot be changed. Ask Orion to revise the analysis when the query cannot be edited.

If a revised extraction fails, its previous successful version remains current. Correct the query and save again before treating the result as updated. An edited draft is not evidence of a successful rerun.

> [!NOTE]
>
> The refresh icon in the notebook header refreshes the displayed notebook
> state. To rerun the analysis against its sources, ask Orion in chat.

## Rerun with Current Data

Ask Orion to rerun the analysis when you need newer results. Check the returned period and source freshness before comparing it with an earlier run.

Use [relative dates](https://docs.runorion.com/chat/best-practices.md#use-relative-dates), such as "last 90 days", for a rolling analysis. A fixed date range remains fixed unless you change it. Rerunning code does not make an upstream source current.

For scheduled runs, use **Create Workflow** under **Save as a Workflow**. Follow [Create a Workflow](https://docs.runorion.com/workflows/create.md) to choose the schedule and output. Validate the analysis before scheduling it.

## Export Code and Results

Use **Export notebook** in the notebook header:

* **Download as .py**: download the Python cells as a script
* **Download as .ipynb**: download a Jupyter notebook with recorded cell outputs

Review the recorded outputs before sharing a Jupyter file. To download an extraction table, use its separate **Download CSV** control.

An export does not recreate Orion's connected environment. Set up the required packages, input data, and connections before executing the code elsewhere.

## Reuse the Work

Save a table as a [View](https://docs.runorion.com/core-concepts/views.md) when another analysis needs the same dataset. Use a [Metric](https://docs.runorion.com/metrics/overview.md) when you need to track a value over time. A [Workflow](https://docs.runorion.com/core-concepts/workflows.md) runs recurring work and produces its configured outputs.

Share the [conversation](https://docs.runorion.com/chat/share-conversations.md) to hand over the analysis. Start a [Room](https://docs.runorion.com/chat/rooms.md) when teammates should investigate in the same conversation.

## Next Steps

> [card] [Running Analyses](https://docs.runorion.com/chat/running-analyses.md)
>
> Ask a question and inspect the resulting work

> [card] [Create a Workflow](https://docs.runorion.com/workflows/create.md)
>
> Schedule an analysis after checking its results


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.