Code to do some data massaging over redshift