How can we achieve one to many relationship in KSQL?

35 views
Skip to first unread message

Mahebub Sayyed

unread,
Nov 28, 2019, 2:06:44 AM11/28/19
to ksqldb-users
Dears,

How can we achieve one to many relationship in KSQL?

    We have ktable activity (act_id, req_id, act_desc). req_id is repeated.
    we want to join it with kstream license (req_id, lic_id). license has unique req_id.  

ktable:activity 
kstream:license
         act_id req_id act_desc
   req_id     Lic_id
1 101 aa
101 10001
2 102 bb
102 10002
3 101 cc


4 102 dd




expected output:





kstream: license_activity

          req_id Lic_id act_id act_desc

10001 101 1 aa

10002 102 2 bb

10001 101 3 cc

10002 102 4 dd


How can we join license stream with activity table to get license_activity stream as above (expected output).

Thanks.

Mahebub Sayyed

unread,
Dec 4, 2019, 6:00:37 AM12/4/19
to Robin Moffatt, ksql-...@googlegroups.com
Thanks for your reply Robin. But I can't invert it. 

All the activities related to 1 license are receiving first. Then license gets generated. License generation process takes undefined time (from days to weeks) . So till license gets generated I have to hold activities. Once license is ready then I have to join all activities to license. 

So I created a table for activities and stream for license. 

Is there any other way to handle this?

Thank you. 
Reply all
Reply to author
Forward
0 new messages