Hans
Hans

Reputation: 128

What happens when there is to much text for Google's App Engine Text property?

I use Google's App Engine TextProperty to store data. The maximum size is 1 megabyte. What happens when I want to store more text?

I have the idea that then last part of the data is stored.

Say Text is capable of storing 10 characters. When I want to store the text '0123456789ABC' I assume that then the value 'ABC' is stored. Is that correct?

Thanks, Hans

Upvotes: 0

Views: 55

Answers (1)

Dmytro Sadovnychyi
Dmytro Sadovnychyi

Reputation: 6201

1 megabyte is per entity limit, not per property. Its really easy to test:

class Foo(ndb.Model):
  value = ndb.StringProperty(indexed=False)

c = Foo(key=model.ndb.Key(Foo, 'test'))
c.value = 'a' * 1200000
c.put()

And got:

RequestTooLargeError: The request to API call datastore_v3.Put() was too large.

You can import this error from google.appengine.runtime.apiproxy_errors so you'll be able to catch it.

Upvotes: 4

Related Questions