Updating all entities of KIND in Google Cloud Datastore

Viewed 310

we have a dataset of ~10 million entities or a certain Kind in Datastore. We want to change the products functionality, so we would like to change the fields on all Kind entities.

Is there a smart/quick way to do it, that does not involve iterating over all of the entities in series?

2 Answers

Probably you can use Dataflow to help you with your problem.

Dataflow is a stream and batch data processing service, fully managed by GCP.

It was open sourced in the Apache Beam project. It is fully compatible with this SDK. This allows you to test your developments locally before run them on GCP.

It exposes two main concepts, a PCollection, basically the data that is being handled by the tool, and pipelines, the different steps necessary to capture the data, the transformations that must be performed, and how and where the results obtained should be written.

It provides support for Java, Python and Go, and a rich feature set and variety of possible data sources and transformations.

In the specific case of Datastore, Dataflow provides support for read, write and delete data. See for instance the relevant documentation for Python.

You can see a good example of how to interact with datastore in the Apache Beam Github repository.

These two other articles could be also interesting: 1 2.

I would presume that you have to loop through each one and update it as it's a NoSQL data store like mongo from what I can see. We have a system that uses SQL and Mongo and the demoralised data is a pain, we had to write migrations that would loop through all and update.

Related