<#C03G7LJTS2G|troubleshooting> Hi All, How do I jo...
# troubleshooting
n
#troubleshooting Hi All, How do I join a DataStream to a Database table that is changing (dynamic) using DataStream API? • For a database table I'm creating a temporary view ex: tableEnv.createTemporaryView("FactTableView" factTable) . Here factTable stream is built by implementing a RichParallelSourceFunction by selecting all columns and rows of the SQL Server table • Creating a temporary view for DataStream objects ex: tableEnv.createTemporaryView("someStreamView", someStream); • Join the DataStream view to Table view. • Problem is Table view result is static and needs to be dynamic. For newer objects in the stream, there are corresponding records in factTable which is not present in FactTableView What is needed is a way to find a corresponding database object row for a DataStream object. Otherwise, is there a way to build "lookup cache" of a certain table and if a matching record is not found, the lookup is done against the database find "Key" column value. Also is this possible in DataStream API ?
m
it's not possible in the datastream API as far as I know
😢 1
n
Thanks @Matan Perelmuter. I did go through the documentation. Will have to see how to design this now :-(
I did find a way to resolve the database lookup issue by implementing a RichFlatMapFunction. In here it's building a cache from db initially in open() and updating the cache when the needed record info isn't available by reading the db for that specific event/message. Thanks to 99 ways to enrich streaming data

https://www.youtube.com/watch?v=cJS18iKLUIY&t=574s▾

I have a new problem now 😞 My scenario is like this. • I get a stream with all kind of messages, let's call it ALL • I build 2 more DataStreams of say A, B and C by using filter function on ALL. • A gets written into db as DimA as it's pretty independent like in a Stateless scenario • B has a dependency on DimA. The B stream needs DimA,Key column value so it gets written into db as DimB The problem now is that sometimes this works. And many times messages of B stream are lost since the DimA record isn't built yet. Stream B is getting processing even before Stream A data is written into db. Is there some option to make B stream wait till the data is available in DimA database record? Or any other solutions? @David Anderson @Matan Perelmuter Would like inputs on this problem.