Google AppEngine / Java和现有数据库

时间:2020-11-29 23:12:34

Is there a way to upload database contents to Google App Engine for Java, like the bulk uploader script in the Python version? If not, how would you get existing data into your GAE/J app?

有没有办法将数据库内容上传到Google App Engine for Java,比如Python版本中的批量上传程序脚本?如果没有,您如何将现有数据导入GAE / J应用程序?

2 个解决方案

#1


You can use the Python uploaders to upload data for your Java app. First, create an app.yaml in an empty directory that contains the following:

您可以使用Python上传程序上传Java应用程序的数据。首先,在包含以下内容的空目录中创建app.yaml:

application: yourappid
version: upload
runtime: python
api_version: 1
handlers:
    - url: /remote_api
      script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py
      login: admin

Then, use 'appcfg.py update .' in that directory. Now you can use the 'bulkloader.py' bulk load tool, pointing it at upload.latest.yourappid.appspot.com. Since multiple major versions can run simultaneously, and all versions of an app share the same datastore, you can use the Python bulk uploader while still running your app in Java.

然后,使用'appcfg.py update。'在那个目录中。现在,您可以使用'bulkloader.py'批量加载工具,将其指向upload.latest.yourappid.appspot.com。由于多个主要版本可以同时运行,并且应用程序的所有版本共享相同的数据存储区,因此您可以在使用Java运行应用程序时使用Python批量上传器。

#2


As far as I know, the only two options available are:

据我所知,现有的两个选项是:

  1. Bulkload.py
  2. GAEBAR

As you have noted, both are python oriented. I have not seen a similar equivalent for GAE/J.

如你所知,两者都是面向python的。我还没有看到类似的GAE / J等价物。

#1


You can use the Python uploaders to upload data for your Java app. First, create an app.yaml in an empty directory that contains the following:

您可以使用Python上传程序上传Java应用程序的数据。首先,在包含以下内容的空目录中创建app.yaml:

application: yourappid
version: upload
runtime: python
api_version: 1
handlers:
    - url: /remote_api
      script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py
      login: admin

Then, use 'appcfg.py update .' in that directory. Now you can use the 'bulkloader.py' bulk load tool, pointing it at upload.latest.yourappid.appspot.com. Since multiple major versions can run simultaneously, and all versions of an app share the same datastore, you can use the Python bulk uploader while still running your app in Java.

然后,使用'appcfg.py update。'在那个目录中。现在,您可以使用'bulkloader.py'批量加载工具,将其指向upload.latest.yourappid.appspot.com。由于多个主要版本可以同时运行,并且应用程序的所有版本共享相同的数据存储区,因此您可以在使用Java运行应用程序时使用Python批量上传器。

#2


As far as I know, the only two options available are:

据我所知,现有的两个选项是:

  1. Bulkload.py
  2. GAEBAR

As you have noted, both are python oriented. I have not seen a similar equivalent for GAE/J.

如你所知,两者都是面向python的。我还没有看到类似的GAE / J等价物。