Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 821095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:35:10+00:00 2026-05-15T02:35:10+00:00

2 possible ways of persisting large strings in the Google Datastore are Text and

  • 0

2 possible ways of persisting large strings in the Google Datastore are Text and Blob data types.

From a storage consumption perspective, which of the 2 is recommended? Same question from a protobuf serialization and deserialization perspective.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T02:35:11+00:00Added an answer on May 15, 2026 at 2:35 am

    There is no significant performance difference between the two – just use whichever one best fits your data. BlobProperty should be used to store binary data (e.g., str objects) while TextProperty should be used to store any textual data (e.g., unicode or str objects). Note that if you store a str in a TextProperty, it must only contain ASCII bytes (less than hex 80 or decimal 128) (unlike BlobProperty).

    Both of these properties are derived from UnindexedProperty as you can see in the source.

    Here is a sample app which demonstrates that there is no difference in storage overhead for these ASCII or UTF-8 strings:

    import struct
    
    from google.appengine.ext import db, webapp
    from google.appengine.ext.webapp.util import run_wsgi_app
    
    class TestB(db.Model):
        v = db.BlobProperty(required=False)
    
    class TestT(db.Model):
        v = db.TextProperty(required=False)
    
    class MainPage(webapp.RequestHandler):
        def get(self):
            self.response.headers['Content-Type'] = 'text/plain'
    
            # try simple ASCII data and a bytestring with non-ASCII bytes
            ascii_str = ''.join([struct.pack('>B', i) for i in xrange(128)])
            arbitrary_str = ''.join([struct.pack('>2B', 0xC2, 0x80+i) for i in xrange(64)])
            u = unicode(arbitrary_str, 'utf-8')
    
            t = [TestT(v=ascii_str), TestT(v=ascii_str*1000), TestT(v=u*1000)]
            b = [TestB(v=ascii_str), TestB(v=ascii_str*1000), TestB(v=arbitrary_str*1000)]
    
            # demonstrate error cases
            try:
                err = TestT(v=arbitrary_str)
                assert False, "should have caused an error: can't store non-ascii bytes in a Text"
            except UnicodeDecodeError:
                pass
            try:
                err = TestB(v=u)
                assert False, "should have caused an error: can't store unicode in a Blob"
            except db.BadValueError:
                pass
    
            # determine the serialized size of each model (note: no keys assigned)
            fEncodedSz = lambda o : len(db.model_to_protobuf(o).Encode())
            sz_t = tuple([fEncodedSz(x) for x in t])
            sz_b = tuple([fEncodedSz(x) for x in b])
    
            # output the results
            self.response.out.write("text:   1=>%dB  2=>%dB  3=>%dB\n" % sz_t)
            self.response.out.write("blob:   1=>%dB  2=>%dB  3=>%dB\n" % sz_b)
    
    application = webapp.WSGIApplication([('/', MainPage)])
    def main(): run_wsgi_app(application)
    if __name__ == '__main__': main()
    

    And here is the output:

    text:   1=>172B  2=>128047B  3=>128047B
    blob:   1=>172B  2=>128047B  3=>128047B
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How many possible ways to send/load data to/from server side data sources and what
There are several possible ways of getting the path to the application data directory:
my question is about two possible ways to access data: (My question is about
What are the possible ways to send data to previous view in iphone. Without
I'm trying to generate all possible 'ways' from one element in matrix to another,
Inspired from this question , was wondering what are the possible ways to create
I used all possible ways to wrap text in textview but it's not working.
What are all the possible ways in which we can get memory leaks in
Searching for possible ways to get cookie with httpOnly enabled, I cannot find any.
I'm looking for possible ways to persist the following classes. Subsonic SimpleRepository looks like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.