Deleting Entities in Bulk

If you need to delete entities in bulk, we recommend using Cloud Dataflow, a managed service for developing and executing data processing workflows. Cloud Dataflow provides a Cloud Datastore delete template that you can use to delete entities selected by a GQL query.

Follow the instructions on this page to enable the Cloud Dataflow API for your project and to use the Cloud Dataflow template to delete entities.

Before you begin

  1. Select a project to run your Cloud Dataflow job. This can be the same project that contains your Cloud Firestore in Datastore mode database.
  2. For the selected project, enable the Cloud Dataflow API:

    Enable the API

  3. Prepare a GQL query that selects all the entities you want to delete. For example, SELECT * FROM Task LIMIT 500.

Deleting entities in bulk

Executing from the Google Cloud Platform Console
  1. Go to the Cloud Dataflow page in the GCP Console.
  2. Go to the Cloud Dataflow page
  3. Click CREATE JOB FROM TEMPLATE.
  4. Cloud Platform Console Create Job From Template Button
  5. Select the Bulk Delete Entities in Cloud Datastore template under Utilities from the Cloud Dataflow template drop-down menu.
  6. Enter a job name in the Job Name field. Your job name must match the regular expression [a-z]([-a-z0-9]{0,38}[a-z0-9])? to be valid.
  7. Enter your parameter values in the provided parameter fields.
  8. Click Run Job.

Refer to the Cloud Dataflow Templates page for executing from gcloud command-line tool or API

Pricing

When using Cloud Dataflow to delete entities in bulk, you are charged for Cloud Dataflow usage and for Cloud Datastore entity reads and deletes. For more details on Cloud Dataflow costs, see the Cloud Dataflow pricing page.

Apakah halaman ini membantu? Beri tahu kami pendapat Anda:

Kirim masukan tentang...

Cloud Datastore Documentation