confluentinc / ksql

The database purpose-built for stream processing applications.
https://ksqldb.io
Other
127 stars 1.04k forks source link

ksqlDB init aggregation data #9795

Open vyegres opened 1 year ago

vyegres commented 1 year ago

Hello! Is ksqlDB has function to initialize aggregate table with some init data? Example:

CREATE  TABLE user_clicks  WITH (
   kafka_topic = 'user_clicks',
   value_format = 'json_sr',
   PARTITIONS=2
) AS  
SELECT 
   user_id, count(user_id) as cnt 
FROM user_clicks_stream 
GROUP BY user_id
EMIT CHANGES;

And I want to add some init data to user_clicks table. Some thing like

INSERT INTO user_clicks (user_id, cnt) VALUES (1,10)

How I can do it?

suhas-satish commented 1 year ago

have you seen this https://docs.ksqldb.io/en/0.10.2-ksqldb/developer-guide/test-and-debug/generate-custom-test-data/