views:

39

answers:

2

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 iterate over each object, but surely there is an easier way?

+3  A: 

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 in 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 :/

Claude Vedovini
This is wrong. The SQLite backend still stores data in the encoded Protocol Buffer format; while it'd be theoretically possible to write something to update data directly, it would be needlessly complex. Also, the asker is referring to the Java SDK, while the SQLite backend is specific to the Python SDK.
Nick Johnson
I admit my answer was wishful thinking based on the announcement that the 1.3.3 SDK was supporting a SQLite backend. Nick is actually among the best persons to answer this. I'll update my answer and upvote his :)
Claude Vedovini
+1  A: 

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.

Nick Johnson
It didn't work for me, I was updating entities and getting exceptions.
Jacob
We need more details than that in order to help. What exceptions? Where?
Nick Johnson