Hi, I have a product table named ‘product’ in MySQL as follows:
product_id | Product | FieldName
1 Milk milk
2 Water water
3 Coffee coffee
Then, I have a source fully de-normalized table named ‘raw_transaction’ as follows:
transaction_Id | Date | customer | milk | water | coffee |
1 1/1/2021 John 1
2 1/1/2021 Mary 1 1
3 1/1/2021 Anna 1
Can you give me a hint on how I can create a pipeline in StreamSets so that I can use the product table as meta-data in creating a dynamic query so that I can populate a ‘FactCustomerProduct’ as follows
For each product in products
INSERT INTO FactCustomerProduct (product_id,date_id,customer_id,transaction_id,quantity)
SELECT p.product_id,r.date_id,customer_id,r.transaction_id,r.<fieldName>
FROM ‘raw_transaction’ r <...]
WHERE r.<fieldName> IS NOT NULL
The idea is to avoid hardcoding in the ETL.
I have tried several processors to not avail.
Any hint is most welcome, in essentially, how can I have a loop through the products and then generate dynamically a query that will be populating the Fact table.
Thank you.