liveBook · Manning

Base table

As explained in Kafka Streams in Action, Second Edition

A base table is a ksqlDB table created directly from a Kafka topic to expose its keyed records for subsequent queries.

A base table is a ksqlDB table created directly against a backing Kafka topic, exposing keyed records for queries. Its primary key identifies the table row. section 11.4

Configure a base table by:

  • Declaring the Kafka key as a typed PRIMARY KEY column. section 11.4
  • Setting key and value formats, such as KAFKA and JSON, in the WITH clause. section 11.4
  • Treating records with the same key as updates and null values as tombstones. section 11.4

User activity table

CREATE TABLE user_activity_table (user_id INT PRIMARY KEY, first_name VARCHAR, last_name VARCHAR, activity VARCHAR, event_time VARCHAR, steps INT) WITH (kafka_topic='user_activity', key_format='KAFKA', value_format='JSON');

How Kafka Streams in Action, Second Edition covers it

How deep it goes
Explains creation syntax, key formats, partitioning implications, update semantics, and tombstones.
Examples
Uses the user_activity Kafka topic and user_activity_table CREATE TABLE statement.
What it assumes
Assumes Kafka key-value records and basic ksqlDB stream and table creation concepts.
What you can do after
Configure ksqlDB to expose keyed Kafka records as a table with explicit serialization settings.
How it connects
Connects base tables to Kafka topics, primary keys, partitions, ksqlDB streams, and Schema Registry.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kafka Streams in Action, Second Edition. The section links point to the parts of the book it draws on.