简体   繁体   中英

No data is getting into a table built over a stream from ksql binary, it get's there if I do the same with ksql prompt?

I'm trying to create a table over a stream using ksql binary. The table gets created and starts running but when I query it there is no data inside the table. When I create the same using ksql prompt the table gets created I'm also able to query the data.

PS: I am setting this property SET 'auto.offset.reset'='earliest'; to query the data form beginning.

I tried both methods. It works when I create table using ksql prompt. Same command does not work when try to do the same with ksql binary.

sudo echo "CREATE TABLE movie_table AS SELECT title, count(*) AS appearance FROM test WHERE year > 1988 GROUP BY title;" | sh /home/binary/ksql http://devopsksql.default.svc.cluster.local:8088
ksql> CREATE TABLE movie_table AS SELECT title, count(*)
 Message
---------------------------
 Table created and running
---------------------------

ksql> select * from MOVIE_TABLE;
^CQuery terminated

Same when I run with ksql prompt open it works as is.

I am expecting a way to create a table and query it without using the ksql prompt.

You need to set SET 'auto.offset.reset'='earliest'; before your CREATE query.

If you want to interact with KSQL from a script I'd suggest using the REST API (eg via curl ) than trying to pipe to the ksql binary.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM