-
Notifications
You must be signed in to change notification settings - Fork 68
Closed
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Hello again, I found what seems to be a bug, here is a test:
from google.cloud import ndb
class Profile(ndb.Model):
name = ndb.TextProperty()
book = ndb.TextProperty()
class SomeKind:
def __init__(self, profile):
self.profile = profile
def init():
profile = Profile(name='Annaka Harris')
profile.put()
return profile.key, SomeKind(profile)
if __name__ == '__main__':
with ndb.Client().context():
key, somek = init()
# Different behavior based on how we query
# ours = Profile.get_by_id(key.id())
# ours = key.get()
ours = [x for x in ndb.Query(kind='Profile').fetch() if x.key == key][0]
ours.book = 'Conscious'
print('putting: ', ours)
ours.put()
print('getting: ', somek.profile)
assert somek.profile.book == 'Conscious'Notes: basically, if we get the model using either get_by_id or key.get(), then the entity on SomeKind will also update; however, if I use ndb.Query, it will not. Previously all worked. You may uncomment different approaches to compare.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.