Changing a field from String to Text

4 views
Skip to first unread message

Joshua Smith

unread,
Apr 23, 2009, 11:30:59 AM4/23/09
to Google App Engine
I stupidly created a field as a StringProperty which I now realize
needs to support longer strings. So I need to replace it with a
TextProperty.

The problem is that my database is already populated with zillions of
records using the StringProperty.

I want to make this transition as safely and painlessly as possible.
Anyone have a recommendation about how to do this?

Nick Johnson

unread,
Apr 23, 2009, 11:36:16 AM4/23/09
to google-a...@googlegroups.com
Hi Joshua,

The only difference between a StringProperty and a TextProperty is the
length limit, and the fact that the latter one is not indexed. If
you're not concerned about the indexing overhead of your existing
records, you can simply change the Model definition; new records will
be unindexed, while old records will remain (unused) in the index
until next time you update them.

If it's important to eliminate the wasted index space, you can simply
fetch and re-put each entity in your datastore.

-Nick Johnson

Sylvain

unread,
Apr 23, 2009, 11:59:31 AM4/23/09
to Google App Engine
Reply all
Reply to author
Forward
0 new messages