[google-appengine] Re: NDB urlsafe keys and REST api requests

2018-04-11 Thread 'Kenworth (Google Cloud Platform)' via Google App Engine
Hi Jason. I can see that you also posted this on StackOverflow 

 which 
we also monitor, and are already getting the right responses from the 
community. I encourage users having similar issues to continue discussions 
on that thread. 

-- 
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+unsubscr...@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/f4191f0a-a512-4dca-a745-5b6bbe67d8ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[google-appengine] Re: NDB urlsafe keys and REST api requests

2018-04-09 Thread Jason Yoon
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 
/// etc. etc. where  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 google-appengine+unsubscr...@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/6c84d9c0-92f2-49e9-a32f-0c1363c389e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[google-appengine] Re: NDB urlsafe keys and REST api requests

2018-04-09 Thread 'Kenworth (Google Cloud Platform)' via Google App Engine
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 google-appengine+unsubscr...@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/dd4208eb-8ad7-46f2-bc1d-03b1c5ba9479%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.