Splitting entities vs. using transactions
I have an entity with two types of properties: Properties that are updated by the user from a web page. Properties that are updated when a third-party service makes an API call to my app. If my entity only had properties of the first type, I wouldn't use transactions to do updates because only a single user would ever be modifying the data. Because a third-party service will be making calls that will also by updating the entity, there is now a risk of losing data if the user is making an edit at the same time as the API call. It seems that to avoid data loss, I could do one of two things: Use transactions for all puts of this entity (they happen in a lot of different places so it would be a fair bit of work), or Split the entity in two where a first entity has properties of the first type that are updated without transactions and a second entity that has properties of the second type (that may be updated with transactions). I'm having trouble deciding which is the better option, and would appreciate advice.
Even with entities split avoiding transactions for the web-interface modified entities might not be as clear/easy as you might expect: the user may attempt to modify the same entity from different sessions/windows/devices the info displayed to the user right after it was modified might not be the one actually existing in the datastore due to eventual consistency In other words it might be safer (and potentially easier, futureproof) to have transactions on the user web interface as well. But even if do that, it might still make sense to split the entitites if it makes sense for your app, it's a common technique, see: updating an entity's property without retrieving the entity from the NDB Google App Engine Datastore entities. Efficiency and structure re-using an entity's ID for other entities of different kinds - sane idea?
“Sample DB” for Google App Engine Datastore
What is the Entity Key for in the Datastore Viewer?
How to get custom attribues of User using Admin Sdk.?
'Model is not immutable' TypeError
How to store data from SmartGWT ListGrid?
BigQuery OAuth access token on Java App Engine dev server
Google App Engine ancestor query in JPA
Google App Engine Go memory management
How to build Many-to-Many relations in Google App-engine using JPA
Currently experiencing frequent DeadlineExceededExceptions when it was fine a few hours ago
How to get related to db.Model entity from datastore - what API allows it?
GAE-Python: Can Appstats record RPC made in background thread?
Blank Page after granting OAuth2 permission in BigQuery GAE Sample
GAE get Data using JDO with key
Setup GAE project with Resteasy using Maven in Eclipse
Working Maven3 configuration for AppEngine + DataNucleus + JPA 2