Solved

Bulk update existing events

  • 21 December 2021
  • 3 replies
  • 67 views

Badge

How can I bulk update existing events with a newly created user property?

We created a new user property and would like to set a value for this property for all existing events created before the new property was created. 

More specifically: we’ve had one domain “de” and are expanding to two new domains (fr, nl) so we introduced a new user property “domain” which will be set to the respective domain for each event. For all events created before the new user property was created, the domain value is (naturally) ‘none’ right now. We’d like to change that and set all of them to “de”. 



 

icon

Best answer by MikkoKarvonen 22 December 2021, 06:33

View original

3 replies

Badge

Following this because I have a use case for this too!

Userlevel 5
Badge +2

There is no easy way to update existing events. The only approach I can really think of is exporting all your data (https://developers.amplitude.com/docs/export-api), writing a script that updates the user properties, setting up a new Amplitude project, and uploading the event history there by using the HTTP API or Batch API. How feasible this is depends largely on the amount of data you have.

However, depending on the types of queries you are running, this may not be necessary. You could set up a cohort with users that currently have the user property set as ´de´ and use that in your queries. Or even a cohort that makes the assumption that all the users that were using your service before the given date should be treated as having the domain value set as ‘de’, depending on your setup. Combined with saved segments, this might cover your needs surprisingly well.

Also keep in mind that as time moves on, the less relevant this missing bit of data will become, as your coverage will naturally become more and more complete. So it’s always worth considering that can you simply mitigate it until it’s no longer an issue.

Badge

Thanks for the detailed response and solution suggestions. We will consider both.

Reply