Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the easiest way to export data from a live Google App Engine application?

I'm especially interested in solutions with source code available (Django independency is a plus, but I'm willing to hack my way through)

like image 783
Silver Dragon Avatar asked Jan 09 '09 02:01

Silver Dragon


Video Answer


2 Answers

You can, of course, write your own handler. Other than that, your options currently are limited to:

  • gae-rest, which provides a RESTful interface to the datastore.
  • approcket, a tool for replicating between MySQL and App Engine.
  • The amusingly named GAEBAR - Google App Engine Backup and Restore.
like image 110
Nick Johnson Avatar answered Sep 28 '22 15:09

Nick Johnson


Update: New version of Google AppEngine supports data import to and export from the online application natively. In their terms this is called upload_data and download_data respectively (names of subcommands of appcfg.py).

Please refer to Google documentation how to export and import data from/to 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.

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)
like image 30
sastanin Avatar answered Sep 28 '22 17:09

sastanin