Update table redshift

I have a requirement where I need to populate running totals: Eg.

Date Product value cum_total
20180201 abc 5 5
20180202 abc 2 7
20180203 abc 4 11
20180204 abc 3 14

This is a simplified version. There are pre-processing to get the data to be loaded to this table. I need to read this table and update the cum_total. By looking at the Redshift Update, my select query will be from this table first 3 columns, and I generate cum_total and I need to update the same table based on the keys – col1 and col2.


Is this similar to your other post, How to get Running Totals?

Yea. I can generate the running totals using sql, but to update i need to use a bunch of keys – at least 4. Looked at the Redshift Update snap and really not sure on how to use the where_clause.


PM me, if you like to discuss this over a call

Got it. I should be using bulk upsert snap instead of update snap.


1 Like