Skip to content

Add turbopuffer sink documentation - #38233

Closed
nstewart wants to merge 1 commit into
mainfrom
claude/turbopuffer-sink-docs-0t6udg
Closed

Add turbopuffer sink documentation#38233
nstewart wants to merge 1 commit into
mainfrom
claude/turbopuffer-sink-docs-0t6udg

Conversation

@nstewart

Copy link
Copy Markdown
Contributor

Motivation

This adds comprehensive documentation for sinking Materialize results to turbopuffer, a vector database service. The documentation covers the complete pipeline: using a Kafka sink to export data from Materialize, then using the mz-tpuf-sink Python library to apply those changes to turbopuffer namespaces.

Description

This PR adds a new documentation page (doc/user/content/serve-results/sink/turbopuffer.md) that guides users through:

  1. Setup: Creating Kafka and schema registry connections, building a materialized view as the search document, and configuring a Kafka sink with Debezium envelope for change capture.

  2. Running the sink: Installing and configuring mz-tpuf-sink, a Python library that consumes from Kafka and applies changes to turbopuffer with transaction atomicity guarantees.

  3. Adding embeddings: Using transforms to compute embeddings (or other derived attributes) only when relevant columns change, avoiding unnecessary recomputation.

  4. Validation: Querying the namespace and testing deletes to confirm the pipeline works end-to-end.

  5. Operational details: Covering transaction atomicity, at-least-once delivery with idempotent writes, column-level updates, and type mapping between Materialize and turbopuffer.

The documentation also updates doc/user/data/sink_external_systems.yml to list turbopuffer as a supported external system alongside other sinks like Kafka and OpenSearch.

Key design points documented:

  • The sink applies each Materialize transaction atomically to turbopuffer
  • Transforms recompute embeddings only when their source columns change
  • The process requires a Materialize connection to track write frontiers across partitions
  • Exactly one process should run per topic/namespace pair to maintain transaction boundaries
  • Column-level patches preserve attributes written from outside the pipeline

Verification

This is documentation-only. No code changes or tests are required. The documentation follows existing patterns in the Materialize docs and references the actual mz-tpuf-sink library on GitHub.

https://claude.ai/code/session_011Anxe7er6ZK6P62jjWqyfG

Documents keeping a turbopuffer namespace in sync with a Materialize view
using the Kafka sink plus mz-tpuf-sink, following the information
architecture of the Elasticsearch and OpenSearch guides.

Beyond the setup steps, the guide covers the correctness properties of the
path: per-timestamp transaction atomicity and the two completeness rules
that make it possible, why the sink needs a Materialize connection to watch
the write frontier, at-least-once delivery with idempotent keyed writes,
read_committed isolation, the single-process-per-topic requirement, key and
document-identity constraints, column-level patch semantics, and why
attribute types are declared rather than inferred.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Anxe7er6ZK6P62jjWqyfG
@nstewart

Copy link
Copy Markdown
Contributor Author

Reviewing the sink source to write the correctness section surfaced two discrepancies in mz-turbopuffer-sink itself. Both are filed there, and neither blocks this PR:

  • MaterializeInc/mz-turbopuffer-sink#1to_attr has no uuid.UUID branch, so a non-key uuid column reaches the writer as a Python object against an attribute declared string.
  • MaterializeInc/mz-turbopuffer-sink#2schema.py's time-millis/time-micros mapping is unreachable. mz_avro has no time-of-day SchemaPiece, so the logical type is dropped when the schema is round-tripped for registration, and Materialize publishes time as an untagged long.

The type mapping table in this guide documents the observed behavior for both: time as int (microseconds since midnight), matching the sink's README and its end-to-end test, and uuid as string. Neither issue changes what the table should say, so no docs change is pending on them.


Generated by Claude Code

@nstewart

Copy link
Copy Markdown
Contributor Author

Closing in favor of #38167

@nstewart nstewart closed this Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants