Reputation: 5655
I am storing HTML in the attribute of an entity. The problem I am facing now is that the size of the HTML can be bigger than 1500 bytes. Am I pushing the boundaries of Google Cloud Datastore ?
I am using TextProperty in my model
class Article(ndb.Model):
title = ndb.StringProperty()
author = ndb.StringProperty()
content = ndb.TextProperty()
date_created = ndb.DateTimeProperty(auto_now_add=True)
date_modified = ndb.DateTimeProperty(auto_now=True)
Question 1
Should I look at storing html in Google Cloud Storage or some other options ?
Question 2
Is it possible to increase the size of the indexed value of a given entity ?
Upvotes: 1
Views: 1661
Reputation: 43334
You are correct to use a TextProperty for string values bigger than 1500 bytes, however TextProperty cannot be indexed and there is your problem.
class TextProperty()
A long string.
Unlike StringProperty, a TextProperty value can be more than 1500 bytes long. However, TextProperty values are not indexed and cannot be used in filters or sort orders.
TextProperty values store text with a text encoding. For binary data, use BlobProperty.
If the text property is required, its value cannot be an empty string.
Is it possible to increase the size of the indexed value of a given entity ?
No. It is possible to index short strings because they are short.
Should I look at storing html in Google Cloud Storage or some other options ?
If it's just 1 html, I suggest you write it to a file.
You can of course also not index the TextProperty, if it's not really required.
Upvotes: 4