Downloading Google App Engine Database

一笑奈何 提交于 2019-11-29 15:49:56

问题


I had created web application and deploy it in Google App Engine after I created table(entity) in Google App Engine datastore. My doubt is it possible to download the entity/database?


回答1:


to enable remote_api, add this to your web.xml:

<servlet>
  <servlet-name>remote-api</servlet-name>
  <servlet-class>com.google.apphosting.utils.remoteapi.RemoteApiServlet</servlet-class>
</servlet>
<servlet-mapping>
  <servlet-name>remote-api</servlet-name>
  <url-pattern>/remote_api</url-pattern>
</servlet-mapping>

details in this thread: http://groups.google.com/group/google-appengine/browse_thread/thread/1bb013cbdd30750b

then, as shay mentioned, use the bulk loader.

(added as an answer instead of a comment only because the XML wouldn't format nicely in a comment.)




回答2:


I had a simple requirement to dump entities from GAE Java based App and restore them to local datastore. I could finally do it with following steps

  1. Add RemoteApiServlet to web.xml and deploy the app

    <servlet>
        <servlet-name>RemoteApi</servlet-name>
        <servlet-class>com.google.apphosting.utils.remoteapi.RemoteApiServlet</servlet-class>
    </servlet>
    <servlet-mapping>
         <servlet-name>RemoteApi</servlet-name>
         <url-pattern>/remote_api</url-pattern>
    </servlet-mapping>
    
  2. Download Google App Engine SDK for Python and unzip

  3. Use bulkloader.py to dump the datastore from GAE

    bulkloader.py --dump --application=s~appid --url=http://appid.appspot.com/remote_api --filename=xyz.dump

    --application is given as s~appid i.e. s tilda appid as app was using HR datastore. For Master/Slave datasotre plain appid will do.

    bulkload.py will prompt for login credentials for app. On authentication it will dump the entities to the file specified.

  4. To restore use following command

    bulkloader.py --restore --application=appid --url=http://127.0.0.1:8888/remote_api --filename=xyz.dump

    For local credentials use email admin and blank password. Even for HRD local datastore use plain appid (s~appid restores data but entities can't be accessed in Development Console - Datastore viewer. I don't know why)

    Dump can be restored to same appid or even to a different appid




回答3:


Yes, using the BulkLoader



来源:https://stackoverflow.com/questions/3699114/downloading-google-app-engine-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!