1
votes

I have a project whose database is in cloud datastore. Now I want to take a backup of all kinds including all its entities in local system. How it should be possible. I also have checked the cloud documentation i.e

1- https://cloud.google.com/datastore/docs/export-import-entities#exporting_entities

2- https://cloud.google.com/sdk/gcloud/reference/datastore/export

but it describes that how to export data from cloud datastore to cloud storage not in local system. Please let me know if anyone knows that how it should be possible.

Thanks!

2

2 Answers

1
votes

It is not possible to get the Managed Export service to export directly to your local filesystem. So you'll need to export your entities to GCS. To use the exports on your local machine you can copy them to your local machine, then import them into the Datastore emulator.

0
votes

I do something like this, but I had to create my own exporter and importer, see my answer to this question https://stackoverflow.com/a/52767415/4458510

To do this I wrote a google dataflow job that exports select models and saves them in google cloud storage in jsonl format. Then on my local host I have an endpoint called /init/ which launches a taskqueue job to download these exports and import them.

To do this i reuse my JSON REST handler code which is able to convert any model to json and vice versa.