Closed thardyman closed 8 years ago
You have three options:
.processBatch
function and chain the function calls: .processBatch((rows) = > {
return etl.pump.addAttribute(rows, 'timestamp', batchTimestamp)
.then(() => { return etl.pump.transform(rows, transformFn); })
.then(() => { return etl.pump.upsertRows(rows); })
})
In the first case, I've just changed the three .processBatch calls into a promise chain. Please note that .processBatch
must return a Promise, otherwise flow control will not work.
Thanks @novaki. That is really helpful. I think I'll go with your first option and see how I get on 👍
I have a pump that I'd like to apply several batch processes to. I can't work out how to do this, as the last .processBatch command seems to overwrite all the preceding ones.
For example, I'd like to add the 'timestamp' attribute, perform some transformation then upsert to my SalesForce API. Here is an excerpt of my pipeline...
My addAttribute function in my SalesForceMixin returns a promise that transforms the item...
I can see that only the 3rd
processBatch
command is executed:etl.pump.upsertRows
. Looking into the code, I think I can see why; the processBatch command overrides the_processBatch
function.Am I missing something? I don't really want to do all my transformation and loading in one function.