Changing StringProperty to TextProperty

594 views
Skip to first unread message

johnP

unread,
Mar 4, 2010, 1:02:34 PM3/4/10
to Google App Engine
Hi -

I have a bunch of records with a StringProperty field. I do not need
them indexed, and now I need to allow users to add more than 500
characters. So I need to migrate these records to TextProperty.

In the dev datastore, simply switching the property in Models does not
show any obvious errors. Is it safe to make such a switch on
production? Or are there possible land-mines I'm not considering?

Thanks for any assistance.

johnP

Waleed Abdulla

unread,
Mar 5, 2010, 1:26:19 AM3/5/10
to google-a...@googlegroups.com
Bump. I was about to post the same question. Is it safe to change the type of a model property from string to text? 

Waleed




--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.


Nick Johnson (Google)

unread,
Mar 5, 2010, 7:24:10 AM3/5/10
to google-a...@googlegroups.com
Yes, it's always safe to switch from StringProperty to TextProperty. Existing records will remain indexed until you get and put them again, but they will work as expected.

-Nick Johnson
--
Nick Johnson, Developer Programs Engineer, App Engine
Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: 368047

timh

unread,
Apr 30, 2013, 8:31:25 PM4/30/13
to google-a...@googlegroups.com
You will need to truncate any TextProperty to <=500 bytes.

Some Potential Approaches 

1. Create a new StringProperty in parallel to the existing TextProperty and gradually rewrite objects truncating as you go.

2. Fetch objects using raw datastore access  (no models involved) and truncate and rewrite them then just update your class definition.
 

On Tuesday, April 30, 2013 2:44:35 PM UTC+8, Hai Bison wrote:
Hi Nick,

How about the opposite way? I mean, is switching from TextProperty to StringProperty safe? Thank you in advance.

Hai
Reply all
Reply to author
Forward
0 new messages