> I would like to be able to do this using web2py. I could also choose to 
> use the GAE API directly to do this but then a could not make use thing 
> like calculated Fields etc in my web2py tables.
>

One issue about forcing key names is that there's no guarantee that the new 
key will provide a valid ID integer when retrieved, and the DAL api 
requires record insertions to provide that kind of value. Note that calls 
to Key.id() can return None, which is used by the insert method to create 
the db reference object. IIRC, the exception of that rule is the case of 
keyed tables, but I'm not if it is supported for gae nosql. In case it is 
supported, the patch could instead use keyed tables for storing entity key 
names.

>From the datastore Python api:

"... The identifier may be either a *key name* string, assigned explicitly 
by the application when the instance is created, or an integer *numeric 
ID,*assigned automatically by App Engine when the instance is written (
put<https://developers.google.com/appengine/docs/python/datastore/modelclass#Model_put>)
 
to the Datastore ..."

I have not tested the behavior but according to the above I think that the 
datastore api would return None instead of valid integer identifiers for 
the case of entities stored with manual key names.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to