[英]What is the easiest way to export data from a live Google App Engine application?
我对可用源代码的解决方案特别感兴趣(Django独立性是一个优点,但我愿意破解我的方式)
You can, of course, write your own handler. 当然,您可以编写自己的处理程序。 Other than that, your options currently are limited to:
除此之外,您的选择目前仅限于:
Update : New version of Google AppEngine supports data import to and export from the online application natively. 更新 :新版Google AppEngine支持本地导入和导出在线应用程序的数据。 In their terms this is called
upload_data
and download_data
respectively (names of subcommands of appcfg.py
). 在他们的术语中,这分别称为
upload_data
和download_data
( appcfg.py
的子命令的名称)。
Please refer to Google documentation how to export and import data from/to GAE . 请参阅Google文档, 了解如何从/向GAE导出和导入数据 。 This is probably the better way to do it today.
这可能是今天更好的方法。
My old answer is below: 我的回答如下:
I use to_xml() method of the Model class to export the datastore. 我使用Model类的to_xml()方法导出数据存储区。
class XmlExport(webapp.RequestHandler):
def get(self):
objects=MyModel.all().fetch(1000)
xml='<?xml version="1.0" encoding="UTF-8"?>\n<site>\n'
for o in objects:
xml = xml + o.to_xml()
xml = xml + '</site>'
self.response.headers['Content-Type']='text/xml; charset=utf-8'
self.response.out.write(xml)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.