App Engine Datastore: can I restore objects of a specific namespace from a full backup?

I created a backup of all objects of all namespaces using Google Cloud Datastore Admin.

I would like to ask if I can restore objects in namespace only.

Example: I have 3 namespaces

  • Namespace_1
  • Namespace_2
  • Namespace_3

All namespaces contain the same entity type, let's say MyEntityKind

I would like to restore only Namespace_3.MyEntityKind from my full backup

How can i do this? In Datastore Admin, I can only select the type and not the namespace when restoring.

thank

+3


source to share


1 answer


Overview

Datastore Admin backups are phasing out, so use the new Managed Export although the same principles apply.

Create a new project, call him staging

. Import the full backup into staging

. Create a new export from staging

just the namespace or view you want. Import this new export into your original project.

Command

Full export to the new system is achieved as follows:

gcloud datastore export gs://${BUCKET}

      



When exporting, for example, there is no direct way to import the selected parts, so you have to switch the project and then import it with the intermediate project. The import command is simple:

gcloud datastore import gs://${BUCKET}/[PATH]/[FILE].overall_export_metadata

      

[PATH] can be found from the results of the export command or by viewing your Cloud Stage bucket in the console. [FILE] is the same as [PATH], but you can confirm it in the user interface.

Now export just the namespace from staging project

:

gcloud datastore export --namespaces="Namespace_3" gs://${BUCKET}

      

Now you only export the namespace you want and can import it back into your original project.

+1


source







All Articles