google-app-engine


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?

Related Links

“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

Categories

HOME
turing-machines
api
deep-learning
ng-idle
phpmyadmin
depth
sitecore
replace
seo
cq5
square
hpc
jetty
echo
missing-data
trac
webix
modal-dialog
special-characters
qpython
mxgraph
spring-social
favicon
selenium-ide
selectize.js
gmm
symbols
gulp-watch
zxing
interpreter
gmock
itunes
jackson-modules
flooding
fragment-backstack
exchangewebservices
scrollview
event-flow
dst
android-gridview
gnat-gps
indy10
xajax
apiary.io
timing
ods
urlsession
ogc
plr
textsum
libgphoto2
magento-2.0.7
term
google-cse
magic-draw
static-cast
java-6
vcloud-director-rest-api
redbeard-ios
jodd
qiime
cfchart
mediametadataretriever
query-by-example
lz77
httpruntime.cache
state-restoration
lasso
eoferror
typemock
alloy-ui
teamcity-9.1
uvc
fits
mmwormhole
uncaught-typeerror
strawberry-perl
encryption-asymmetric
ignite-ui
lambda-architecture
gnumeric
synapse
xmltodict
ecslidingviewcontroller
gd-graph
code-duplication
dtmf
unit-of-work
observium
video-codecs
qi4j
patricia-trie
landscape-portrait
cuteeditor
interprocess
visualj#
asynchronous-wcf-call
fail-fast-fail-early
linfu-dynamicproxy
online-storage

Resources

Encrypt Message