Max length of String stored with App Engine?
Asked Answered
C

4

12

When storing String fields with App Engine:

  • What is the maximum length() of the String that App Engine datastore can handle?
  • Also if using Objectify, is this max length the same or Objectify does some processing that affect this max length?
Chen answered 7/10, 2012 at 3:29 Comment(0)
Y
9

Objectify will automatically convert Strings of more than 500 characters to native Text storage. Be careful if you are indexing strings; Text objects are not indexed so the String > 500 chars will be unindexed.

Yuji answered 7/10, 2012 at 18:20 Comment(1)
appears a save will fail if String is >500 char and is indexed. com.googlecode.objectify.SaveException: Error saving Call Info=: At path 'notes': Request to index a value that cannot be indexed:. Is there a workaround for this?Vagrant
P
5

I think the responses to this one are out of date, so I am updating. I'm using GAE version 1.9.22 and received this in the error logs:

String properties must be 1500 bytes or less. Instead, use com.google.appengine.api.datastore.Text, which can store strings of any length.

Using com.google.appengine.api.datastore.Text works well by converting the String object to Text (e.g., new Text(thisString) on the server side of your code. Any reference to libraries in com.google.appengine.api.datastore.* do not work on the client side. Class not found.

Positronium answered 1/7, 2015 at 0:48 Comment(0)
P
4

Per the documentation, 500 characters. And no, Objectify is a wrapper and does not modify your data, so the data size limitations are unchanged.

Procurable answered 7/10, 2012 at 4:54 Comment(0)
D
1

Based on updates to Google Datastore documentation from October, 2016, here are the limits

Maximum size of an indexed string property's UTF-8 encoding: 1,500 bytes

Maximum size for an unindexed property: 1,048,487 bytes (1 MiB - 89 bytes)

So you can store strings close to 1MB in size in an unindexed String property.

Dionnadionne answered 23/5, 2017 at 17:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.