Suicide Bunny
Suicide Bunny

Reputation: 938

How to list/show most recent data in a ksql stream?

I have created a ksql stream using

CREATE STREAM basic_streams (data VARCHAR) \
 WITH (KAFKA_TOPIC='main-topic',VALUE_FORMAT='JSON');

I have a producer running, pumping data into the stream. Is it possible to list/show the most recent items sent to the ksql stream?

Thanks

P.S. I tried in ksql server and the results are

ksql> list streams;

 Stream Name   | Kafka Topic              | Format
---------------------------------------------------
 BASIC_STREAMS | main-topic | JSON
---------------------------------------------------
ksql> PRINT main-topic;
Could not find topic 'MAIN-TOPIC', KSQL uses uppercase.
To print a case-sensitive topic apply quotations, for example: print 'topic';

and when i tried

ksql> print 'main-topic';

it hangs there forever

Upvotes: 2

Views: 3177

Answers (1)

Andrew Coates
Andrew Coates

Reputation: 1893

You can run:

  • PRINT 'main-topic' FROM BEGINNING; to see all rows in topic.
  • `PRINT 'main-topic'; to see all rows added to the topic
  • PRINT main-topic; in more recent versions of ksqlDB as the topic name is case-sensitive
  • Or SELECT * FROM basic_streams; to achieve the same in a more SQL way.

Upvotes: 1

Related Questions