Is it possible to have two streaming sources doing Merge into the same delta table with each source setting a different set of fields?
We are trying to create a single table which will be used by the service layer for queries. The table can be populated from multiple source tables each contributing a set of fields to the sink schema.
Sample query for the scenario:
MERGE INTO sink
USING source_a
ON source_a.id = sink.id
WHEN MATCHED THEN
UPDATE SET
id = source_a.id,
summary = source_a.summary,
description = source_a.description,
customerId = source_a.customerId
WHEN NOT MATCHED
THEN INSERT (
id,
summary,
description,
customerId
)
VALUES (
source_a.id,
source_a.summary,
source_a.description,
source_a.customerId
)
MERGE INTO sink
USING source_b
ON source_b.customer.id = sink.customerId
WHEN MATCHED THEN
UPDATE SET
customerId = source_b.customerId,
customerName = source_b.customerName,
customerIndustry = source_b.customerIndustry
I am new to streaming and was wondering whether there is some way to implement this using streaming queries. Currently seeing out of order issues when merging the data to the sink, But is there something which can be done to go around the problem.