Setting Reliable Create and Update Fields

Having accurate Create and Update attributes on golden records make exporting only the changed golden records a simple task. I have been made aware the b_credate and b_upddate cannot always be trusted. Here is a quick and easy way to get those two fields populated correctly.

  1. Obviously create the two fields in the model. Make sure they are easily distinguishable from b_credate and b_uppdate. I will use biz_create biz_update.
  2. Create one enricher for both of the fields.
  3. Since the enricher runs in the order they are defined, first set biz_create with the following:

    coalesce(GoldenRecord.biz_create, to_char(CURRENT_TIMESTAMP()))

  4. Then enrich biz_update:
    --Sets initial the initial value for  biz_update with the same timestamp as biz_create. From there update for every new SD record.

    CASE

                  WHEN GoldenRecord.biz_create IS NULL THEN biz_create

                  ELSE to_char(CURRENT_TIMESTAMP())

    END

You should be good to go. I fear they may be a more elegant solution, if you please feel free to modify and/or comment.