1

I am planning to store some data in a listproperty and want to be sure that the order of the items in the list remains the same when I query my entity back out. Is there such a guarantee when putting and getting data from the datastore?

To be clear, I am not trying to order a set of results by anything in the listproperty, I just want to make sure that if I have a list of strings (for example: "Sam", "Alberto", "Rick"), they are always in that order when I access that entity.

The answer to this question would imply that they do always stay the same, but I'd like to be sure: Use a ListProperty or custom tuple property in App Engine?

2 Answers 2

4

The statement from the documentation is:

Order is generally preserved, so when entities are returned by queries and get(), the list properties values are in the same order as when they were stored. There's one exception to this: Blob and Text values are moved to the end of the list; however, they retain their original order relative to each other.

(From http://code.google.com/appengine/docs/python/datastore/datamodeling.html)

So, if you are only storing strings, they should be returned in the correct order.

1

ListProperties work just like python lists; they are ordered and will remain ordered.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.