App Engine:将实时数据存储区复制到本地开发数据存储区(仍然有效) [英] App Engine: Copy live Datastore to local dev Datastore (that still works)

查看:71
本文介绍了App Engine:将实时数据存储区复制到本地开发数据存储区(仍然有效)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

过去,这可以通过使用bulkloader下载并上传到本地dev服务器来实现.但是,由于不支持oauth2,批量加载程序下载已无法使用了几个月.

This used to be possible by downloading with the bulkloader and uploading to the local dev server. However, the bulkloader download has been non-functional for several months now, due to not supporting oauth2.

一些地方建议从云存储备份下载,然后通过批量加载器或直接解析备份上传到本地数据存储.但是,这些都不再起作用. bulkloader方法抛出:

A few places recommend downloading from a cloud storage backup, and uploading to the local datastore through either bulkloader or by directly parsing the backup. However, neither of these appear functional anymore. The bulkloader method throws:

OperationalError: unable to open database file

用于读取备份文件的RecordsReader类在尝试读取第一条记录时到达文件末尾,导致没有记录被读取.

And the RecordsReader class, which is used to read the backup files, reaches end of file when trying to read the first record, resulting in no records being read.

是否存在用于将实时数据存储区复制到本地dev数据存储区的当前实用功能?

Does there exist a current, functional, method for copying the live datastore to the local dev datastore?

推荐答案

尽管有一些注意事项,批量加载程序仍可在具有OAuth2的Python上运行.从实时应用下载时,刷新OAuth2令牌存在问题,因此总下载时间限制为3600秒,如果您将刷新令牌与--oauth2_refresh_token一起手动使用,则总下载时间限制为3600 + 3600.

The bulkloader is still functional on Python with OAuth2, albeit with some caveats. In downloading from the live app, there is an issue with refreshing of the OAuth2 token so the total download time is limited to 3600 seconds, or 3600+3600 if you manually use a refresh token with --oauth2_refresh_token.

上传到开发服务器应用程序时,OAuth2将失败并显示401,因此有必要编辑google.appengine.ext.remote_api.handler并存根"CheckIsAdmin"以始终返回True作为解决方法:

When uploading to the development server app, OAuth2 will fail with a 401, so it's necessary to edit google.appengine.ext.remote_api.handler and stub out 'CheckIsAdmin' to always return True as a workaround:

def CheckIsAdmin(self):
  return True
  user_is_authorized = False
  ...

但是,我对以上答案表示赞同,因为目前看来它是一种更强大的解决方案.

I upvoted the above answer however, as it looks like a more robust solution at this point.

这篇关于App Engine:将实时数据存储区复制到本地开发数据存储区(仍然有效)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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