Sure, here is the context for my question.

I have a frontend angular client that is deployed in a separate front-end 
service and calls another back-end service which returns appropriate JSON 
data back to the angular client. As part of this process, the backend 
(built off python) uses the App Engine Python NDB Standard library to 
access the datastore and process the data before returning it back to the 
client.

Currently, I construct my REST endpoints such that it is 
<resource>/<id>/<resource>/<id> etc. etc. where <id> represents the 
12-digit unique ID of the entity so that the respective backend endpoint 
can identify the appropriate resource and return it back to the client.

The issue I am facing now is that many of the datastore models have 
ancestor relationships associated with them and it turns out that if an 
entity is a part of a different ancestor hierarchy, it can generate the 
same 12-digit ID as another entity with a different hierarchy. Though the 
chance of this is low, I've encountered it with some stress tests in the 
development environment, which then causes collisions as the datastore is 
just returning the first entity with that ID even though it may not be the 
one required by the call.

Therefore, to resolve this, I decided to pass urlsafe keys between client 
and backend services as keys are always unique, regardless of ancestor 
relationships because ancestors are built into the keys that are generated. 
This leads to the question above.


On Monday, April 9, 2018 at 1:46:08 PM UTC-4, Kenworth (Google Cloud 
Platform) wrote:
>
> To help you find the answers you are looking for, can you please explain 
> further what are you trying to achieve? Including the following:
>
> 1- Do you want to expose Datastore REST api to clients?
> 2- Do you want to design your own API?
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/6c84d9c0-92f2-49e9-a32f-0c1363c389e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to