views:

220

answers:

1

I have a list of key names that I want to bulk fetch (the key names are stored in a StringListProperty attached to an entity). My general plan was to do:

usernames = userrefInstance.users # A collection of strings on another 
model. 
keys = [Key.from_path('User', key_name) for username in usernames] 
users = db.get(keys)

My questions does Key.from_path hit the datastore? I am trying to be as quick as possible and if Key.from_path hits the data store I need to work another way to store a collection of keys - I don't particularly want to store the Key object in a list property as I also provide user friendly queries across the StringListPropererties.

+2  A: 

After digging and questions on another group, it turns out that:

keys are entirely determined by the app ID and the path, so there's no need to access the datastore for this. - Nick Johnson

Or you can also use a List of db.Key

Kinlan
Does that mean I can get credit for the answer here, too? ;)
Nick Johnson
Sure - Put an answer in, I will delete this one and then accept yours ;)
Kinlan