Skip to content

Commit abe3d7c

Browse files
committed
Merge pull request #331 from tseaver/266-document_text_vs_bytes_values
Fix #266: Document further how 'text' vs. 'bytes' values are stored.
2 parents 2b73c7b + 95336d9 commit abe3d7c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

gcloud/datastore/entity.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,16 @@ class Entity(dict):
6868
>>> dict(entity)
6969
{'age': 20, 'name': 'JJ'}
7070
71+
.. note::
72+
73+
When saving an entity to the backend, values which are "text"
74+
('unicode' in Python2, 'str' in Python3) will be saved using
75+
the 'text_value' field, after being encoded to UTF-8. When
76+
retrieved from the back-end, such values will be decoded to "text"
77+
again. Values which are "bytes" ('str' in Python2, 'bytes' in
78+
Python3), will be saved using the 'blob_value' field, without
79+
any decoding / encoding step.
80+
7181
"""
7282

7383
def __init__(self, dataset=None, kind=None):

0 commit comments

Comments
 (0)