[google-appengine] Re: Are datastore Ids unique across all namespaces?

2019-06-14 Thread 'Harmit Rishi (Cloud Platform Support)' via Google App Engine
In order to effectively address your question, I would like to take a 
moment and explain the characteristics of a Entity 
. Each entity 
within Datastore has a key that uniquely identifies it. The key (as you 
provided) consists of the following components: 

1. Namespace of the entity
2. The kind 

 
of entity (categorized for queries)
3. An Identifier 

 
for the individual entity (can be a key name string or a integer numeric 
id.)

I will be assuming that you are referring to the integer numeric id for 
your question. 

As far as having two of the same numeric ID's goes, indeed it is possible 
and this can be done by having your application assign their own numeric 
IDs manually to the entitles being created. However, as indicated in the 
documentation here 
,
 
"there is nothing to prevent a Datastore mode database from assigning one 
of your manual numeric IDs to another entity". You will have to implement 
the *allocateids() 
*method
 
within your application which will allow you to obtain a block of IDs in 
order to avoid the conflict mentioned above.

Also, since you mentioned that "Datastore is the one automatically 
generating the ids", the documentation found here 

 states 
that the "automatic ID generator will keep track of IDs that have been 
allocated" and that Datastore "will avoid reusing them for another entity".

Therefore to sum it all up, Yes you can achieve the goal you want. However, 
it would be a good idea to implement the best practices for it as well such 
as: manually assigning Ids with implementing *allocateids() 
*
. 

I hope this helps!

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/8cef0d63-0f78-44b0-838a-06edd79ed05f%40googlegroups.com.


[google-appengine] Re: Are datastore Ids unique across all namespaces?

2019-06-14 Thread NP
Thanks for your response. And yes, I was referring to the numeric id.

In case it wasn't clear from my post, I actually want the ids to be unique. 
I was just trying to confirm that it is.

The reason I would prefer the ids are unique is because I have seeded data 
which all my users can use. The users can then in turn create entities for 
their application which are saved with a namespace for the user. Since each 
user basically has access to 2 namespaces (the default or blank namespace 
which contains my seeded data and the namespace for their app), I would 
like to search for entities by just their numeric ids. If I find the 
record, I then check the namespace associated with the corresponding key. 
For this to work, the ids need to be unique across all namespaces.



On Friday, June 14, 2019 at 7:06:48 PM UTC-7, Harmit Rishi (Cloud Platform 
Support) wrote:
>
> In order to effectively address your question, I would like to take a 
> moment and explain the characteristics of a Entity 
> . Each entity 
> within Datastore has a key that uniquely identifies it. The key (as you 
> provided) consists of the following components: 
>
> 1. Namespace of the entity
> 2. The kind 
> 
>  
> of entity (categorized for queries)
> 3. An Identifier 
> 
>  
> for the individual entity (can be a key name string or a integer numeric 
> id.)
>
> I will be assuming that you are referring to the integer numeric id for 
> your question. 
>
> As far as having two of the same numeric ID's goes, indeed it is possible 
> and this can be done by having your application assign their own numeric 
> IDs manually to the entitles being created. However, as indicated in the 
> documentation here 
> ,
>  
> "there is nothing to prevent a Datastore mode database from assigning one 
> of your manual numeric IDs to another entity". You will have to implement 
> the *allocateids() 
> *method
>  
> within your application which will allow you to obtain a block of IDs in 
> order to avoid the conflict mentioned above.
>
> Also, since you mentioned that "Datastore is the one automatically 
> generating the ids", the documentation found here 
> 
>  states 
> that the "automatic ID generator will keep track of IDs that have been 
> allocated" and that Datastore "will avoid reusing them for another entity".
>
> Therefore to sum it all up. Yes, you can achieve the goal you want. 
> However, it would be a good idea to implement the best practices for it as 
> well such as: manually assigning Ids with implementing *allocateids() 
> *
> . 
>
> I hope this helps!
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/58ed4348-39d1-4888-8b84-1fc2c45289e4%40googlegroups.com.


[google-appengine] Re: Are datastore Ids unique across all namespaces?

2019-06-17 Thread 'Nicolas (Google Cloud Platform Support)' via Google App Engine


Hi,

 

I understand your use case and I think the best way to accomplish that 
would be something like suggested in this StackOverflow 

 
post and set up your own  GUIDs.

 

I hope that helps!



On Friday, June 14, 2019 at 10:53:30 PM UTC-4, NP wrote:
>
> Thanks for your response. And yes, I was referring to the numeric id.
>
> In case it wasn't clear from my post, I actually want the ids to be 
> unique. I was just trying to confirm that it is.
>
> The reason I would prefer the ids are unique is because I have seeded data 
> which all my users can use. The users can then in turn create entities for 
> their application which are saved with a namespace for the user. Since each 
> user basically has access to 2 namespaces (the default or blank namespace 
> which contains my seeded data and the namespace for their app), I would 
> like to search for entities by just their numeric ids. If I find the 
> record, I then check the namespace associated with the corresponding key. 
> For this to work, the ids need to be unique across all namespaces.
>
>
>
> On Friday, June 14, 2019 at 7:06:48 PM UTC-7, Harmit Rishi (Cloud Platform 
> Support) wrote:
>>
>> In order to effectively address your question, I would like to take a 
>> moment and explain the characteristics of a Entity 
>> . Each entity 
>> within Datastore has a key that uniquely identifies it. The key (as you 
>> provided) consists of the following components: 
>>
>> 1. Namespace of the entity
>> 2. The kind 
>> 
>>  
>> of entity (categorized for queries)
>> 3. An Identifier 
>> 
>>  
>> for the individual entity (can be a key name string or a integer numeric 
>> id.)
>>
>> I will be assuming that you are referring to the integer numeric id for 
>> your question. 
>>
>> As far as having two of the same numeric ID's goes, indeed it is possible 
>> and this can be done by having your application assign their own numeric 
>> IDs manually to the entitles being created. However, as indicated in the 
>> documentation here 
>> ,
>>  
>> "there is nothing to prevent a Datastore mode database from assigning one 
>> of your manual numeric IDs to another entity". You will have to implement 
>> the *allocateids() 
>> *method
>>  
>> within your application which will allow you to obtain a block of IDs in 
>> order to avoid the conflict mentioned above.
>>
>> Also, since you mentioned that "Datastore is the one automatically 
>> generating the ids", the documentation found here 
>> 
>>  states 
>> that the "automatic ID generator will keep track of IDs that have been 
>> allocated" and that Datastore "will avoid reusing them for another entity".
>>
>> Therefore to sum it all up. Yes, you can achieve the goal you want. 
>> However, it would be a good idea to implement the best practices for it as 
>> well such as: manually assigning Ids with implementing *allocateids() 
>> *
>> . 
>>
>> I hope this helps!
>>
>>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/8b2ce549-ab1e-40c9-93b3-126d2bc17a5a%40googlegroups.com.


[google-appengine] Re: Are datastore Ids unique across all namespaces?

2019-06-17 Thread NP
Thanks.

That link answered my question with the answer being - No, the Ids are not 
unique across all namespaces. The link also provided a solution for me if I 
need them to be unique.


On Monday, June 17, 2019 at 12:55:36 PM UTC-7, Nicolas (Google Cloud 
Platform Support) wrote:
>
> Hi,
>
>  
>
> I understand your use case and I think the best way to accomplish that 
> would be something like suggested in this StackOverflow 
> 
>  
> post and set up your own  GUIDs.
>
>  
>
> I hope that helps!
>
>
>
> On Friday, June 14, 2019 at 10:53:30 PM UTC-4, NP wrote:
>>
>> Thanks for your response. And yes, I was referring to the numeric id.
>>
>> In case it wasn't clear from my post, I actually want the ids to be 
>> unique. I was just trying to confirm that it is.
>>
>> The reason I would prefer the ids are unique is because I have seeded 
>> data which all my users can use. The users can then in turn create entities 
>> for their application which are saved with a namespace for the user. Since 
>> each user basically has access to 2 namespaces (the default or blank 
>> namespace which contains my seeded data and the namespace for their app), I 
>> would like to search for entities by just their numeric ids. If I find the 
>> record, I then check the namespace associated with the corresponding key. 
>> For this to work, the ids need to be unique across all namespaces.
>>
>>
>>
>> On Friday, June 14, 2019 at 7:06:48 PM UTC-7, Harmit Rishi (Cloud 
>> Platform Support) wrote:
>>>
>>> In order to effectively address your question, I would like to take a 
>>> moment and explain the characteristics of a Entity 
>>> . Each 
>>> entity within Datastore has a key that uniquely identifies it. The key (as 
>>> you provided) consists of the following components: 
>>>
>>> 1. Namespace of the entity
>>> 2. The kind 
>>> 
>>>  
>>> of entity (categorized for queries)
>>> 3. An Identifier 
>>> 
>>>  
>>> for the individual entity (can be a key name string or a integer numeric 
>>> id.)
>>>
>>> I will be assuming that you are referring to the integer numeric id for 
>>> your question. 
>>>
>>> As far as having two of the same numeric ID's goes, indeed it is 
>>> possible and this can be done by having your application assign their own 
>>> numeric IDs manually to the entitles being created. However, as indicated 
>>> in the documentation here 
>>> ,
>>>  
>>> "there is nothing to prevent a Datastore mode database from assigning one 
>>> of your manual numeric IDs to another entity". You will have to implement 
>>> the *allocateids() 
>>> *method
>>>  
>>> within your application which will allow you to obtain a block of IDs in 
>>> order to avoid the conflict mentioned above.
>>>
>>> Also, since you mentioned that "Datastore is the one automatically 
>>> generating the ids", the documentation found here 
>>> 
>>>  states 
>>> that the "automatic ID generator will keep track of IDs that have been 
>>> allocated" and that Datastore "will avoid reusing them for another entity".
>>>
>>> Therefore to sum it all up. Yes, you can achieve the goal you want. 
>>> However, it would be a good idea to implement the best practices for it as 
>>> well such as: manually assigning Ids with implementing *allocateids() 
>>> *
>>> . 
>>>
>>> I hope this helps!
>>>
>>>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/43530034-e9e4-42ad-963c-4d79faddde7c%40googlegroups.com.


[google-appengine] Re: Are datastore Ids unique across all namespaces?

2019-06-18 Thread 'Nicolas (Google Cloud Platform Support)' via Google App Engine


I’m glad to know we were able to help you,

 

Have a great day!


On Monday, June 17, 2019 at 11:05:39 PM UTC-4, NP wrote:
>
> Thanks.
>
> That link answered my question with the answer being - No, the Ids are not 
> unique across all namespaces. The link also provided a solution for me if I 
> need them to be unique.
>
>
> On Monday, June 17, 2019 at 12:55:36 PM UTC-7, Nicolas (Google Cloud 
> Platform Support) wrote:
>>
>> Hi,
>>
>>  
>>
>> I understand your use case and I think the best way to accomplish that 
>> would be something like suggested in this StackOverflow 
>> 
>>  
>> post and set up your own  GUIDs.
>>
>>  
>>
>> I hope that helps!
>>
>>
>>
>> On Friday, June 14, 2019 at 10:53:30 PM UTC-4, NP wrote:
>>>
>>> Thanks for your response. And yes, I was referring to the numeric id.
>>>
>>> In case it wasn't clear from my post, I actually want the ids to be 
>>> unique. I was just trying to confirm that it is.
>>>
>>> The reason I would prefer the ids are unique is because I have seeded 
>>> data which all my users can use. The users can then in turn create entities 
>>> for their application which are saved with a namespace for the user. Since 
>>> each user basically has access to 2 namespaces (the default or blank 
>>> namespace which contains my seeded data and the namespace for their app), I 
>>> would like to search for entities by just their numeric ids. If I find the 
>>> record, I then check the namespace associated with the corresponding key. 
>>> For this to work, the ids need to be unique across all namespaces.
>>>
>>>
>>>
>>> On Friday, June 14, 2019 at 7:06:48 PM UTC-7, Harmit Rishi (Cloud 
>>> Platform Support) wrote:

 In order to effectively address your question, I would like to take a 
 moment and explain the characteristics of a Entity 
 . Each 
 entity within Datastore has a key that uniquely identifies it. The key (as 
 you provided) consists of the following components: 

 1. Namespace of the entity
 2. The kind 
 
  
 of entity (categorized for queries)
 3. An Identifier 
 
  
 for the individual entity (can be a key name string or a integer numeric 
 id.)

 I will be assuming that you are referring to the integer numeric id for 
 your question. 

 As far as having two of the same numeric ID's goes, indeed it is 
 possible and this can be done by having your application assign their own 
 numeric IDs manually to the entitles being created. However, as indicated 
 in the documentation here 
 ,
  
 "there is nothing to prevent a Datastore mode database from assigning one 
 of your manual numeric IDs to another entity". You will have to implement 
 the *allocateids() 
 *method
  
 within your application which will allow you to obtain a block of IDs in 
 order to avoid the conflict mentioned above.

 Also, since you mentioned that "Datastore is the one automatically 
 generating the ids", the documentation found here 
 
  states 
 that the "automatic ID generator will keep track of IDs that have been 
 allocated" and that Datastore "will avoid reusing them for another entity".

 Therefore to sum it all up. Yes, you can achieve the goal you want. 
 However, it would be a good idea to implement the best practices for it as 
 well such as: manually assigning Ids with implementing *allocateids() 
 *
 . 

 I hope this helps!



-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/3e4f6c57-1521-483c-9f70-2a161941a75a%40googlegroups.com.