Dev48
Language
  • About
  • Services
  • Industries
  • Technologies
  • Articles
  • Contacts
Book a call
    Home/Articles/We rebuilt notebooks around executable cells
Dev48
info@dev48.org+375 29 320-40-96WhatsApp@isky_by

© 2026 · All rights reserved.

We rebuilt Notebooks around executable cells

Фото: Vinay Bhushan Meesala (Unsplash) — https://unsplash.com/photos/white-ruled-paper-on-brown-wooden-table-J5k-Ma9Wy0Y?utm_source=dev48&utm_medium=referral

Source: Posthog•November 23, 2026 at 12:13 PM

We rebuilt Notebooks around executable cells

Here's an afternoon I've had more times than I'd like. I write a HogQL query in PostHog and get a table back. Then I hit the edge of what SQL is good…

Here's an afternoon I've had more times than I'd like. I write a HogQL query in PostHog and get a table back. Then I hit the edge of what SQL is good at. I want to fit a curve, reshape the data, or draw a chart PostHog doesn't have. So I export a CSV, open a notebook somewhere else, and paste it in. Now the query lives in one place and the analysis in another.

Our old Notebooks didn't excite me as a user. You could pull in saved insights and write text around them. Good for reporting, but you couldn't run anything.

So we rebuilt Notebooks around cells you can run. SQL, Python, and markdown cells run in place and pass data to each other. Go from a HogQL query to a pandas transform to a chart, then back to SQL, without leaving the page or exporting a CSV.

Notebooks are in beta now. Open one in your project.

There are three kinds of cell that run:

  • SQL cells run HogQL against your events, persons, sessions, and any data warehouse table you've synced. Results come back as a table you can chart.
  • Python cells run in a sandbox with pandas, numpy, scipy, scikit-learn, and matplotlib already installed.
  • Markdown cells hold the commentary around your charts and graphs.

Cells share data, so they can work together to tell the story you want. Every cell outputs a named dataframe that any other cell can read. Python cells see it as a pandas.DataFrame. SQL cells see it as a table, queried by a DuckDB engine inside the notebook.

So if a Python cell reshapes data, the next SQL cell can query the result directly. PostHog spots the reference and runs that query locally instead of in the warehouse. You can bounce between SQL and Python as many times as the analysis needs.

Here I pulled errors for one MCP tool with SQL, broke them down in Python, and charted them with matplotlib.

Why a persistent kernel instead of stateless cells?

We could have made every cell re-run clean each time. Instead, a persistent kernel stores the dataframes.

Thorough analysis often means diving deep into data. You fetch a dataset, then branch out to explore different slices or correlations within it. Without a persistent kernel, every new query or Python script that relies on a previous output would have to re-run the queries behind it. The risk is stale data, so a dependency graph flags downstream cells when something upstream changes.

Why DuckDB as the local engine for querying dataframes?

It's one of the fastest single-node engines for columnar work. It also reads Arrow and remote Parquet well, which is what we needed. When data outgrows memory, it spills to disk. That's slower, but the query finishes instead of failing.

Why configurable compute per notebook instead of one fixed size?

Different analyses need different amounts of memory or compute. We spin up a default node when you run your first Python cell. You can pick a bigger one when the job needs it.

How the PostHog team uses Notebooks

We build for users, and for ourselves. Here are three notebooks the team made recently.

Answer a question that uses product and external data

Does company size predict how much a customer spends with us? We joined our billing and usage data with headcount and funding synced from an enrichment tool. One SQL cell pulls both together, and the next tests which traits track revenue.

The answer: firmographics barely matter. All 68 company fields together explain far less of spending than four usage numbers do.

Write up an incident so it stays accurate

After an outage, we want a record of what happened, when, and who it impacted. Each incident gets a notebook with a write-up, timeline, diagram, and a live query counting the errors. Because the query is live, if you reopen the notebook next week it shows the real numbers instead of a screenshot that's now out of date.

Build a monthly growth report that updates itself

Every month we review how our data products are growing. That used to mean rebuilding a slide deck. Now it's a notebook with live charts. We add commentary each month, so data insights and our own take live side by side as the data changes.

All of these features are in beta and free to use right now. Once they're generally available, notebook sandboxes will be billed based on the node specs you provision.

Next, we'll make the in-notebook AI agent more effective at using the context available to it. We're also improving the UX so Notebooks feel intuitive for both simple and complex data analysis.

Let us know what you'd like to see in PostHog Notebooks, and what would make your data analysis 10x easier. If you want to try it now, open a notebook.

← All articles

What this article says

More in MarTech & AdTech

All →
We tried replacing our agent's decision step with a model 50 times faster. It got slower.
RudderStack

We tried replacing our agent's decision step with a model 50 times faster. It got slower.

Key insights from Grow with Braze Bangkok 2026
Braze

Key insights from Grow with Braze Bangkok 2026

Integrations for Sales Team Growth
Activecampaign

Integrations for Sales Team Growth

We Miss You Emails: Examples and Templates
Activecampaign

We Miss You Emails: Examples and Templates

Reactivation Email: Win Back Contacts
Activecampaign

Reactivation Email: Win Back Contacts

Win-Back Email Subject Lines: 50 Examples
Activecampaign

Win-Back Email Subject Lines: 50 Examples

More from Posthog

Scaling customer success with PostHog
Posthog

Scaling customer success with PostHog

Behind the scenes of a $400,000 billboard campaign
Posthog

Behind the scenes of a $400,000 billboard campaign

We accidentally launched our new UI
Posthog

We accidentally launched our new UI

The modern data stack had a good run
Posthog

The modern data stack had a good run

Self-Driving is out of beta (we finally fixed the pricing, too)
Posthog

Self-Driving is out of beta (we finally fixed the pricing, too)

Updated events data retention for new paid plans
Posthog

Updated events data retention for new paid plans