Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Meta Engineering 7 min read Case study mediumAdept

SQL Notebooks: Combining the power of Jupyter and SQL editors for data analytics

Meta's SQL Notebooks extends its Daiquery SQL editor with notebook-style named cells that reference each other as tables, compiling dependent cells into self-contained CTE queries run on distributed backends like Presto and Spark rather than on a local machine. Sandboxed Python cells can post-process upstream SQL outputs as Pandas dataframes but cannot fetch data themselves. Because SQL can be statically checked against table and column ACLs, cached outputs are only shown to users who could have run the queries, so results can be shared safely and refreshed by scheduled jobs to avoid staleness. Jupyter-based notebooks (Bento) remain better for ML and service-API work, and the two tools are being merged.

Assumes: SQL common table expressionsJupyter notebooks

Related posts

  • Scheduling Jupyter Notebooks at Meta

    Meta Engineering mediumAdept

    Meta schedules Bento (Jupyter) notebooks through a custom Dataswarm operator, BentoOperator, which keeps data lineage visible and privacy enforced even though notebook code is arbitrary. Structured SQL and upload cells are executed by transparent Dataswarm operators outside the notebook and swapped for pandas read_csv/to_csv calls. This lets the notebook itself run in a network-isolated ephemeral container, after which the outputs are uploaded to the warehouse. Scheduling is limited to ETL and analysis notebooks without other side effects, tied to a purpose policy zone, and goes through code review with the notebook checked into source control. Planned work covers more data sources, parameterized notebooks and event-based scheduling.

  • Visualizing BlueSky data with Evidence.dev

    ClickHouse mediumAdept

    Evidence.dev builds dashboards from SQL and markdown, running queries at build time rather than at request time. Query results are stored as Parquet files and queried in the browser with DuckDB WASM, which gives up data freshness in exchange for fast page loads. The walkthrough installs a community ClickHouse connector, points it at the public BlueSky dataset, and writes one query per .sql file. It then runs `npm run sources`, renders a BarChart component in a markdown page, and deploys the result as a static site or to Evidence Cloud with scheduled refreshes.

  • Introducing the SQL Console on Datasets

    Hugging Face mediumAdept

    Hugging Face Hub datasets now have a one-click SQL Console that runs DuckDB WASM entirely in the browser against each dataset's Parquet files, with views created per split and config. Non-Parquet datasets have their first 5GB auto-converted. A simple filter over a 12.6M-row dataset returns in under 3 seconds, but memory is capped at roughly 3GB and DuckDB WASM lacks some DuckDB features such as the hf:// protocol. A worked example uses struct_pack to convert an Alpaca dataset into conversational format for LLM fine-tuning and exports the results to Parquet.

  • How we made querying Pandas DataFrames with chDB 87x faster

    ClickHouse mediumAdept

    chDB, the in-process embedded ClickHouse, sped up SQL queries over Pandas DataFrames 87x by replacing its original Parquet serialize/deserialize round-trip through file descriptors with a native Python table engine that reads Python objects directly. The new engine is built from a TableFunctionPython, StoragePython and PythonSource that feed ClickHouse's concurrent pipeline. To keep multi-threaded execution from serializing on the GIL and to avoid reference-counting pitfalls, the team concentrated CPython API calls before the pipeline runs, batched copies with SIMD memcpy, and reimplemented Python str encoding conversion in C++. Together these changes cut ClickBench Q23 from over 30s to 0.56s and put chDB ahead of DuckDB in the SQL-on-DataFrame benchmark. chDB v2.0.2 also adds chdb.PyReader for user-defined Python table functions, demonstrated by querying the Google Calendar API with SQL.

  • Institutional knowledge doesn't scale: Building an agentic data analyst

    incident.io mediumAdept

    incident.io built an internal "data brain" agent that answers business questions against BigQuery by encoding institutional analyst knowledge rather than relying on raw text-to-SQL. A query skill routes the agent through per-domain themes, vetted SQL examples and schema subsets hydrated at compile time by a Go CLI from the semantic layer, dbt manifest and BigQuery metadata. A guarded data_query tool dry-runs SQL, enforces table allow-lists and scan limits, and logs every call with the guidance consulted. Examples are bootstrapped from certified dashboard SQL, and a theme-audit routine catches guidance rot such as stale examples, missing coverage and trigger-phrase collisions. Over half the company uses it weekly, with near 60% week-on-week retention.

The quest for software engineering knowledge.

Look:
Layout: