3

I'm experimenting with the Google cloud storage backup feature for an application.

After downloading the backup files using gsutil, how can they be loaded into a local development server?

Is there a parser available for these formats (eg, protocol buffers)?

proppy
  • 10,495
  • 5
  • 37
  • 66
12345
  • 565
  • 7
  • 12

3 Answers3

7

Backups are stored in leveldb record format, you should be able to read then using:

proppy
  • 10,495
  • 5
  • 37
  • 66
7

Greg Bayer wrote some Python code showing how to do this in a blog post:

# Make sure App Engine SDK is available
import sys
sys.path.append('/usr/local/google_appengine')
from google.appengine.api.files import records
from google.appengine.datastore import entity_pb
from google.appengine.api import datastore

raw = open('path_to_datastore_export_file', 'r')
reader = records.RecordsReader(raw)
for record in reader:
  entity_proto = entity_pb.EntityProto(contents=record)
  entity = datastore.Entity.FromPb(entity_proto)
  #Entity is available as a dictionary!
matt burns
  • 24,742
  • 13
  • 105
  • 107
John Lowry
  • 249
  • 3
  • 4
0

For those using windows change the open line to: raw = open('path_to_datastore_export_file', 'rb')

The file must be opened in binary mode!

Dabble
  • 39
  • 2