HOW-TO · FLOW BOOKS

Let Claude write the next notebook cell.

By Chris Davidson, founder of yForest · Updated September 26, 2026

Pull a result with SQL, then ask Claude to write the Python cell that charts or joins it, referencing the prior cell's output directly.

Start 14-day free trial Download on theMac App Store

No credit card. 14 days. Cancel in one click.

macOS 15+ · Apple Silicon native · 14-day free trial · No credit card

Quick answer: In a Flow Books notebook, focus a cell and click Ask (or ⌘L), then describe what that cell should do. Claude writes SQL or Python depending on the cell type, and can reference outputs from cells that already ran in the same session, so a chart cell can use a SQL cell's result by name with no export step in between.

Before you start

You'll need a Flow Books notebook open against a connection, and an API key added in Settings if you want Claude to write cells rather than typing them by hand.

Step by step

  1. Open Flow Books and create or open a notebook against your connection.
  2. Add a SQL cell and run it to pull a result.
  3. Add a Python cell below it and open Ask (or ⌘L).
  4. Describe what you want the cell to do, mentioning the prior cell’s result if it should use it.
  5. Review the code Claude writes, then run the cell.

A worked example: SQL into a chart

Pull a result with a SQL cell against a Redshift connection:

SELECT date_trunc('week', event_date) AS week,
       count(*) AS signups
FROM public.signups
GROUP BY 1
ORDER BY 1;

Then, on a Python cell, ask Claude to chart the signups-by-week result as a line plot. It writes a pandas/matplotlib cell using that result, so you're not exporting to a CSV and reimporting it into a separate notebook just to plot one number.

Check it worked

Run the cell. If the chart reflects the real numbers from the SQL cell above it rather than placeholder data, it picked up the right result. If it can't find what you're referring to, mention the prior cell more specifically, by what it queried, not just "the last result."

Troubleshooting

If you seeFix
The cell references data that doesn't match the prior queryBe specific about which cell's result you mean, especially in a notebook with several SQL cells.
A chart with the wrong columns plottedSay which column you meant explicitly instead of accepting the default guess.
Python cell fails on a missing packageFlow Books ships common data packages by default; an unusual one may need a roadmap request.
The generated SQL cell uses the wrong tableCheck the explorer for the exact table name and mention it directly in your question.

What this is good for

Quick joins between a SQL result and something else, a CSV, a second query, a hand-typed list, without leaving the notebook. It's not meant to replace a full data science environment; it's meant to remove the export-and-reimport step between a query and a chart or a quick calculation.

Where this fits next to the SQL editor's Ask panel

Flow Books and the SQL editor's Ask panel use the same underlying model and key, they're two surfaces for the same feature. Use the editor for a single query and its answer; use Flow Books when the next step is Python, a chart, a join with a file, or a few queries chained together in one document.

A second worked example: joining a query with a CSV

Say you have a SQL cell pulling customer IDs and lifetime value from Postgres, and a separate CSV of account managers by customer ID that isn't in the database at all. Load the CSV as a connection, then ask a Python cell to join the two on customer ID and show the top account manager by total lifetime value. Claude writes the pandas merge using both sources, something you'd otherwise do by exporting one side to a spreadsheet and doing the lookup by hand.

Keeping notebooks reproducible

Since each cell's code is visible and editable, a notebook Claude helped write isn't a black box, anyone opening it later can read exactly what ran, adjust a filter, and re-run it. That matters more the longer a notebook sticks around as a working reference rather than a one-off scratchpad.

QueryFlow Studio $9.99/mo · $99/yr
QueryFlow Pipelines $29.99/mo · $199.99/yr

Frequently asked

Does Claude see the outputs of earlier cells?

It can reference a prior cell's result when you mention it in your question, the same schema and result context the Ask panel uses elsewhere in QueryFlow carries into Flow Books.

Can it write both SQL and Python cells?

Yes, matching whichever cell type you're working in, SQL grounded in the connection's schema, Python using standard pandas patterns.

Is Flow Books part of Studio or Pipelines?

Flow Books is part of Studio and above, the same tier as the SQL editor and Ask panel.

Can a notebook cell reference a CSV I loaded separately?

Yes, a CSV or Excel file added as a connection works the same as any other source inside a Flow Books notebook.

What if the generated cell doesn't do quite what I wanted?

Describe the correction directly rather than rewriting from scratch, the same follow-up pattern as the Ask panel in the SQL editor.

No more exporting between tools.

14-day free trial, no card. Open Flow Books and try your first cell.

Start 14-day free trial

No credit card. 14 days. Cancel in one click.