Hi Nick,

Thanks for your clarification! It helps me a lot.

On Wed, Sep 23, 2009 at 10:31 PM, Nick Johnson (Google)
<nick.john...@google.com> wrote:
> Hi Takashi,
>
> On Wed, Sep 23, 2009 at 1:56 PM, Takashi Matsuo <matsuo.taka...@gmail.com>
> wrote:
>>
>> Hi,
>>
>> I noticed db.allocate_ids method is very useful when bulkloading. I
>> have a question about the spec of this function.
>>
>> Q1.
>> Isn't it possible to allocate ids for children entities of particular
>> entity?
>> It seems that this function allocates only for root entities.
>
> Yes - just pass a model or key representing a child entity you want to
> allocate IDs for.
>
>>
>> Q2.
>> Isn't it possible to control what id to start allocating?
>> Let's say I need to allocate ids from 1 to 1000 of particular kind.
>> I've mistakenly invoke as follows:
>>
>> ids = db.allocate_ids(an_instance, 100)
>> (100 instead of 1000)
>>
>> Of cause, ids are (1, 100), oops. So I tried to allocate the rest with
>> 900 as second parameter.
>>
>> ids = db.allocate_ids(an_instance, 900)
>>
>> I expected that ids are (101,1000), but actual result is (2001, 2900).
>>
>> How can I allocate ids from 101 to 1000 explicitly in this case?
>
> IDs aren't guaranteed to be sequential - you can't safely use IDs that
> weren't returned by allocate_ids or assigned to your models, and you can't
> request a specific range.
> -Nick Johnson
>>
>> --
>> Takashi Matsuo
>> The father of kay framework
>>
>>
>
>
>
> --
> Nick Johnson, Developer Programs Engineer, App Engine
> Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number:
> 368047
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to