Reputation: 31
I created a backup of all entities of all namespaces using Google Cloud Datastore Admin.
I would like to ask if can I restore entities only on a namespace.
Example: I have 3 namespaces
All namespaces contain the same entity kind let's say MyEntityKind
I would like to restore only Namespace_3.MyEntityKind from my full backup
How can I do that? In Datastore Admin, I can only select kind but not namespace when doing a restoration.
Thanks
Upvotes: 3
Views: 581
Reputation: 42038
Datastore Admin backup is being phased out, so using the new managed exports functionality, although the same principles apply.
Create a new project, let's call it staging
. Import the full backup into staging
. Create a new export from staging
for just the namespace or kind you want. Import this new export into your original project.
A full export in the new system is achieved as such:
gcloud datastore export gs://${BUCKET}
When exported like this, there isn't a direct method to import select parts, so you need to switch project, then import it a staging project. The importing command is straightforward:
gcloud datastore import gs://${BUCKET}/[PATH]/[FILE].overall_export_metadata
[PATH] can be found from the results from the export command, or browsing your Cloud Stage bucket in the console. [FILE] is the same as [PATH], but you can confirm in the UI.
Now, export the just the namespace you want from the staging project
:
gcloud datastore export --namespaces="Namespace_3" gs://${BUCKET}
You now have an export with just the namespace you want, and can import it back into the original project.
Upvotes: 2