2

Hi guys I've dumped (made a backup) of my Appengine datastore entities,following this tutorial, now I wonder if there is a way to restore the data locally ? so I can do some test and debug.

Dan McGrath
  • 41,220
  • 11
  • 99
  • 130
Adelin
  • 18,144
  • 26
  • 115
  • 175
  • 1
    Well this section of the tutorial tells you how to upload as well https://developers.google.com/appengine/docs/python/tools/uploadingdata#Python_Downloading_and_uploading_all_data – Tim Hoffman Nov 02 '13 at 06:31
  • 1
    The key word here is "locally". That document doesn't say anything about local datastores. – husayt Oct 11 '14 at 17:27
  • Are you using Python or Java? – Ryan Oct 13 '14 at 13:28
  • answer for Java would be appreciated, but i am sure many would like to hear more on python way too – husayt Oct 14 '14 at 15:32
  • @Adelin I really wonder how to dump datastore entities in to one file that could be copied datastore.db. I am on the same issue. Waiting for the reply. Thanks – asdf_enel_hak Oct 17 '18 at 18:21

3 Answers3

5

In windows, the datastore is in the directory

C:\Users\UserName\AppData\Local\Temp\AppName

In OSx this question can help you

In this directory are storade the datastore.db (the local storage), change the name (the app should not be running, and if is locked, kill all the python process)

Now go to the appengine dashboard

  1. click in your app link
  2. click in Blob Viewer (i'm assumming that you did the backup into a blobstore)
  3. click in the file name
  4. click in download
  5. rename the file to datastore.db
  6. copy to the previous path
  7. start the app
Community
  • 1
  • 1
Kristian Damian
  • 1,360
  • 3
  • 22
  • 43
4

Remote API (as koma mentions) is the main GAE-documented approach, and it's a good approach. Alternatively, you can download the entities using the cloud download tool, write your own store reader/deserializer, and execute it within your dev server local instance: http://gbayer.com/big-data/app-engine-datastore-how-to-efficiently-export-your-data. Read the part about the New Approach...

While these options are not automatic and require engineering, I really wanted to point out the side effect of doing this: We have been facing performance issues in the local development server for months now, specifically when the datastore has more than 1,000 entities with over 50 indexes. Just search for "require_indexes slow" and you'll see what I'm talking about.

I'm sure you have a solid reason to import lots of data locally for testing and debugging, just wanted to let you know your application will perform extremely slow, and debug mode will be impossibly slow; we can't even use debug mode with our setup anymore.

Bardia D.
  • 693
  • 3
  • 8
1

If you want to get some test data in your local db, you could copy some using the remote api

koma
  • 6,486
  • 2
  • 27
  • 53