Deleting Entities in Bulk

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

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

Before you begin

  1. Select a project to run your Dataflow job. This can be the same project that contains your Cloud Firestore in Datastore mode database.
  2. For the selected project, enable the 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 Console
  1. Go to the Dataflow page in the Cloud Console.
  2. Go to the 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 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 Dataflow to delete entities in bulk, you are charged for Dataflow usage and for Datastore entity reads and deletes. For more details on Dataflow costs, see the Dataflow pricing page.

Оцените, насколько информация на этой странице была вам полезна:

Оставить отзыв о...

Текущей странице
Cloud Datastore Documentation