2

I am using Kafka REST API issued from curl POST to ksql If I do not use LIMIT20, it hangs. Also If I use it to query on a table again it hangs. I am running this from inside a python script Here I am querying from in between rowtime bcoz I can't get latest results from a stream as it is continuous and persistent.

data = {"ksql":"SELECT MAX(ROWTIME),TIMESTAMPTOSTRING(ROWTIME, 'yyyy-MM-dd HH:mm:ss'),MYFIRMWAREVERSION,MYBASEMACID,BOOTTS,IMEI,PRODDEVICESERIALNUM,RESETREASON FROM NOV_STREAM WHERE TIMESTAMPTOSTRING(ROWTIME, 'yyyy-MM-dd HH:mm:ss') >= '2018-12-11 00:29:30'AND TIMESTAMPTOSTRING(ROWTIME, 'yyyy-MM-dd HH:mm:ss') <= '2018-12-11 23:29:30' GROUP BY ROWTIME,MYFIRMWAREVERSION,MYBASEMACID,BOOTTS,IMEI,PRODDEVICESERIALNUM,RESETREASON LIMIT 20;","streamsProperties":{"ksql.streams.auto.offset.reset": "earliest","format": "json"}}
Matthias J. Sax
  • 59,682
  • 7
  • 117
  • 137
Nanobrains
  • 275
  • 1
  • 3
  • 11

1 Answers1

7

This is expected. A KSQL query, unless you use LIMIT, is a continuous streaming query. That is, it will -- by design -- not terminate by itself. This is the case for both streams and tables.

For tables, the query continues to run and will show you any subsequent updates to the table in its query output.

miguno
  • 14,498
  • 3
  • 47
  • 63
  • how to see output of a streaming query in tools like curl or Postman? .. Yes i understand that response is chunked and it will run forever but if i use this endpoint in my application, how will user see output of this real time data? – Sana.91 Jun 02 '20 at 23:17
  • See https://docs.ksqldb.io/en/latest/developer-guide/ksqldb-rest-api/query-endpoint/ – miguno Jun 09 '20 at 07:37