views:

304

answers:

2

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

+5  A: 

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.
Nick Johnson
+1  A: 

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