Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 28 additions & 8 deletions docs-mintlify/admin/connect-to-data/data-sources/ksqldb.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,11 @@ cubes:
time_dimension: CUBE.created_at
granularity: second
partition_granularity: day
# ksqlDB does not support NOW(); use CURRENT_TIMESTAMP with INTERVAL arithmetic instead.
build_range_start:
sql: "SELECT date_trunc('day', DATE_SUB(NOW(), INTERVAL '5 hour'))"
sql: "SELECT date_trunc('day', CURRENT_TIMESTAMP - INTERVAL '5 hour')"
build_range_end:
sql: "SELECT DATE_ADD(NOW(), INTERVAL '15 minute')"
sql: "SELECT CURRENT_TIMESTAMP + INTERVAL '15 minute'"
refresh_key:
every: 1 minute
update_window: 1 hour
Expand Down Expand Up @@ -510,11 +511,12 @@ cube("order_events_stream", {
time_dimension: CUBE.created_at,
granularity: `second`,
partition_granularity: `day`,
// ksqlDB does not support NOW(); use CURRENT_TIMESTAMP with INTERVAL arithmetic instead.
build_range_start: {
sql: `SELECT date_trunc('day', DATE_SUB(NOW(), INTERVAL '5 hour'))`,
sql: `SELECT date_trunc('day', CURRENT_TIMESTAMP - INTERVAL '5 hour')`,
},
build_range_end: {
sql: `SELECT DATE_ADD(NOW(), INTERVAL '15 minute')`,
sql: `SELECT CURRENT_TIMESTAMP + INTERVAL '15 minute'`,
},
refresh_key: {
every: `1 minute`,
Expand Down Expand Up @@ -603,6 +605,22 @@ with:

<Warning>

**The ksqlDB stream (or table) name and the backing Kafka topic name
MUST be identical, including case.** Kafka streams mode will fail if
they differ in any way.

Take this into account when creating the stream — explicitly set the
topic name to match the stream name (and vice versa). For example:

```sql
CREATE STREAM ORDER_EVENTS_STREAM (...)
WITH (KAFKA_TOPIC='ORDER_EVENTS_STREAM', VALUE_FORMAT='JSON', ...);
```

The match is **case-sensitive**: `OrderEvents` and `ORDEREVENTS` are
treated as different names and will cause the build to fail with
`Topic table ... is not found`.

This is a known limitation of Kafka streams mode. It does not occur
when the ksqlDB object name and the Kafka topic name are the same,
which is the default behavior when ksqlDB creates a stream or table
Expand Down Expand Up @@ -672,10 +690,11 @@ pre_aggregations:
time_dimension: CUBE.created_at
granularity: second
partition_granularity: day
# ksqlDB does not support NOW(); use CURRENT_TIMESTAMP with INTERVAL arithmetic instead.
build_range_start:
sql: "SELECT date_trunc('day', DATE_SUB(NOW(), INTERVAL '5 hour'))"
sql: "SELECT date_trunc('day', CURRENT_TIMESTAMP - INTERVAL '5 hour')"
build_range_end:
sql: "SELECT DATE_ADD(NOW(), INTERVAL '15 minute')"
sql: "SELECT CURRENT_TIMESTAMP + INTERVAL '15 minute'"
refresh_key:
every: 1 minute
update_window: 1 hour
Expand Down Expand Up @@ -707,11 +726,12 @@ pre_aggregations: {
time_dimension: CUBE.created_at,
granularity: `second`,
partition_granularity: `day`,
// ksqlDB does not support NOW(); use CURRENT_TIMESTAMP with INTERVAL arithmetic instead.
build_range_start: {
sql: `SELECT date_trunc('day', DATE_SUB(NOW(), INTERVAL '5 hour'))`,
sql: `SELECT date_trunc('day', CURRENT_TIMESTAMP - INTERVAL '5 hour')`,
},
build_range_end: {
sql: `SELECT DATE_ADD(NOW(), INTERVAL '15 minute')`,
sql: `SELECT CURRENT_TIMESTAMP + INTERVAL '15 minute'`,
},
refresh_key: {
every: `1 minute`,
Expand Down