如何将AppEngine云存储备份加载到本地开发服务器? [英] How can one load an AppEngine cloud storage backup to a local development server?

查看:53
本文介绍了如何将AppEngine云存储备份加载到本地开发服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为应用程序试用Google云存储备份功能.

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

使用gsutil下载备份文件后,如何将其加载到本地开发服务器中?

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)?

推荐答案

Greg Bayer编写了一些Python代码,展示了如何在

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!

这篇关于如何将AppEngine云存储备份加载到本地开发服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆