Once these IDs have been allocated they may be provided manually to
newly created entities.
Since the datastore's automatic ID allocator will never assign
a key to a new entity that will cause an existing entity to be
overwritten, entities written to the given key range will never be
overwritten. However, writing entities with manually assigned keys in this
range may overwrite existing entities (or new entities written by a
separate request) depending on the key range state returned.
This method should only be used if you have an existing numeric id
range that you want to reserve, e.g. bulk loading entities that already
have IDs. If you don't care about which IDs you receive, use allocate_ids
instead.
Args
model
Model instance, Key or string to serve as a template specifying the
ID sequence in which to allocate IDs. Allocated ids should only be used
in entities with the same parent (if any) and kind as this key.
One of (KEY_RANGE_EMPTY, KEY_RANGE_CONTENTION, KEY_RANGE_COLLISION). If
not KEY_RANGE_EMPTY, this represents a potential issue with using the
allocated key range.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2022-09-30 UTC."],[[["This function allocates a range of IDs for entities in the datastore, allowing manual assignment of these IDs to new entities."],["Allocated IDs within this range will not be automatically assigned by the datastore to new entities, preventing accidental overwrites."],["Manually assigning IDs within this range can still lead to overwriting entities, depending on the key range's status."],["The function is best suited for reserving a specific numeric ID range, especially for tasks like bulk loading entities with pre-existing IDs."],["The function returns one of the following: `(KEY_RANGE_EMPTY, KEY_RANGE_CONTENTION, KEY_RANGE_COLLISION)` which may represent an issue with the range allocated."]]],[]]