Charlie
Charlie

Reputation: 31

Importing specific kinds from Datastore backup made via Datastore export

I have a daily export that backs up my Datastore to a Cloud Storage bucket on Google Cloud Platform. I followed the directions as described here: https://cloud.google.com/datastore/docs/schedule-export

I do not specify by kind or namespace. As such, the storage bucket contains a folder structure looking like

Buckets/<bucket-name>/<YYYYMMDD-######>/default_namespace/all_kinds/

In which are the output-### files.

I want to import from this backup, but I only want one Kind of entity. According to this reference: https://cloud.google.com/sdk/gcloud/reference/datastore/import

I should be able to do that with this command: $ gcloud datastore import --kinds='Customer','Order'

However, when I run the following with the variables filled in:

$ gcloud datastore import --kinds='<kind>' gs://<bucket-name>/YYYYMMDD-######/YYYYMMDD-######.overall_export_metadata
ERROR: (gcloud.datastore.import) INVALID_ARGUMENT: The requested kinds/namespaces are not available

I get the above error. I have tried with multiple Kinds which I am sure are part of the Datastore.

Am I able to import by specific Kind if I exported without heed to Kind?

Thanks.

Upvotes: 3

Views: 1926

Answers (2)

Mehul Parmar
Mehul Parmar

Reputation: 380

You would have got the answer by now but just to update others this is the reason -

To import a specific subset of kinds and/or namespaces, provide an entity filter with values for kinds and namespace IDs.

You can specify kinds and namespaces only if the export files were created with an entity filter. You can not import a subset of kinds and namespaces from an export of all entities.

In short make sure you are passing filter while exporting also in first place.

gcloud datastore import/export --kinds="KIND1,KIND2" --namespaces="(default),NAMESPACE2" gs://bucket-name/file-path/file-name.overall_export_metadata --async

Upvotes: 0

Alex Riquelme
Alex Riquelme

Reputation: 1554

Hello I'm working at Google Cloud. I've been able to reproduce your case and it seems that it is an issue in Google Cloud Datastore. I created an entry for you in issuetracker, you can stay tuned here. Thank you for reporting.

Upvotes: 1

Related Questions