开发者

GAE Altering data in your local object store

I have been working on an application using GAE in eclipse and I have a bunch of data objects. Sometimes I need to change their type, ie String -> Text so they can store more data.

What is the quickest easiest way to do a bulk update on the data/object store? I know I could probably write Java code to ite开发者_如何学Gorate over each object, but surely there is an easier way?


Normally there is no other way than iterating the store and changing the data by hand. The datastore is not otherwise accessible. However starting from version 1.3.3 of the SDK there is now the possibility to use SQLite as the datastore backend. To enable, set the flag --use_sqlite=true

You'll need then to find the SQLite file and should be able to use any SQLite client to manipulate the data.

UPDATE: As Nick Johnson noted, SQLite support is only available for the Python SDK and the data is encoded, making the task of directly editing the tables content rather difficult depending on the change. This invalidates this answer given the poster is looking for an easy, Java based solution :/


The best option for this is the newly released appengine-mapreduce library, which has both Java and Python versions.

In the case of converting from String to Text, though, there's no need to go through and update old entities manually - they'll be fixed when they're next written by your app, and will still work correctly in the meantime.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜