Created
July 11, 2014 14:55
-
-
Save jasonaguilon-wf/cf7109b60b87d49f934c to your computer and use it in GitHub Desktop.
Comparing size of ndb repeated property with json property.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| In [38]: ids = [uuid.uuid1().hex for n in range(20000)] | |
| In [39]: class Foo(ndb.Model): | |
| ....: bar = ndb.TextProperty(compressed=True, repeated=True) | |
| ....: bazz = ndb.JsonProperty(compressed=True, json_type=list) | |
| ....: | |
| In [40]: len(Foo(bar=ids)._to_pb().Encode()) | |
| Out[40]: 1218594 | |
| In [41]: len(Foo(bazz=ids)._to_pb().Encode()) | |
| Out[41]: 132491 |
Author
Author
btw, here's the db way:
from google.appengine.ext import db
sz_in_bytes = len(db.model_to_protobuf(some_entity).Encode())
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://developers.google.com/appengine/docs/python/datastore/#Python_Quotas_and_limits