Behaviour of NDB put

55 views
Skip to first unread message

Bradley Mclain

unread,
Apr 18, 2017, 9:28:46 PM4/18/17
to Google App Engine Mailing List
Can someone clarify for me the behaviour of the put method on NDB entities? Does it save all properties on the entity or only changed ones?

If it does save all properties is there a way to instruct it to only save specific or changed properties?

Thanks,

Brad

Richard Cheesmar

unread,
Apr 19, 2017, 3:55:26 AM4/19/17
to Google App Engine
I believe it saves the whole model again, not 100% on that though. Be interesting to know for a fact. I know it uses eventual consistency so it may take a little time to reflect on the site.

Jordan (Cloud Platform Support)

unread,
Apr 19, 2017, 4:32:33 PM4/19/17
to Google App Engine
Currently, when updating a Datastore Entity you use the 'put' method. A 'put' in the Datastore is a blind write that saves the whole entity back to the Datastore without first looking at any differences. 

If you would like the 'put' operation to work by only writing the delta difference of the new entity, you can submit a Feature Request with your use-case and business requirements for the feature. 

Bradley Mclain

unread,
Apr 19, 2017, 6:16:03 PM4/19/17
to Google App Engine Mailing List
Thanks for the clarification.

I had suspected it was persisting all fields as it seems to be the source of bug we experienced with overlapping background requests sometimes overwriting each others information even though they dealt with different attributes.

Lodged as feature request and will look into a work-around for our code base.

On Thu, Apr 20, 2017 at 6:32 AM, 'Jordan (Cloud Platform Support)' via Google App Engine <google-a...@googlegroups.com> wrote:
Currently, when updating a Datastore Entity you use the 'put' method. A 'put' in the Datastore is a blind write that saves the whole entity back to the Datastore without first looking at any differences. 

If you would like the 'put' operation to work by only writing the delta difference of the new entity, you can submit a Feature Request with your use-case and business requirements for the feature. 

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscribe@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/fc31bcda-edab-4795-9a22-4fac3da1dd36%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages