[web2py] Re: GAE: insert using "key_name"

2014-01-12 Thread Alan Etkin
> I gues my question is, can users safely rely on _ methods? > The change revert is due this concern about api reliability, so adapters behave as specified in http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=_insert#Raw-SQL What is w2p's "policy" regar

[web2py] Re: GAE: insert using "key_name"

2014-01-12 Thread Quint
ok, understood. This is really the only thing I need: def _pre_process(self, table, **fields): """ Takes a w2p table and a dictionary with values and processes the field input and add defaults, computes, etc using the web2py table. """ fields = table._de

[web2py] Re: GAE: insert using "key_name"

2014-01-11 Thread Alan Etkin
> Sorry for the confussion.. > But it works fine. I will definitally use this. > > (I posted something stupid and removed the stupid post but left some > traces. ;-)) > Well there are good reasons not to add the feature, at least with the current name: https://groups.google.com/d/msg/web2py-d

[web2py] Re: GAE: insert using "key_name"

2014-01-09 Thread Alan Etkin
> But it works fine. I will definitally use this. Ok. If you can, it would be useful if you could share your tests about supported features for records lacking id values and any issue you find with setters and getters using key names. Note that the Rows class supports defining objects using dic

[web2py] Re: GAE: insert using "key_name"

2014-01-09 Thread Quint
Sorry for the confussion.. But it works fine. I will definitally use this. (I posted something stupid and removed the stupid post but left some traces. ;-)) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.

[web2py] Re: GAE: insert using "key_name"

2014-01-09 Thread Alan Etkin
> Works great! > > On Thursday, January 9, 2014 7:21:45 PM UTC+1, Quint wrote: > Excellent! > > > I already included it to try it out but how do i use it? Your message is confusing, does it work or it does not? It worked for my environment (recent release of gae sdk and development server)

[web2py] Re: GAE: insert using "key_name"

2014-01-09 Thread Quint
Please Ignore that. I got it. Works great! On Thursday, January 9, 2014 7:21:45 PM UTC+1, Quint wrote: > > Excellent! > > I already included it to try it out but how do i use it? > > When I use your example I get: > > AttributeError: 'DAL' object has no attribute '_insert' > (obviously because t

[web2py] Re: GAE: insert using "key_name"

2014-01-09 Thread Quint
Excellent! I already included it to try it out but how do i use it? When I use your example I get: AttributeError: 'DAL' object has no attribute '_insert' (obviously because there is no _select() in DAL) When i try: db._adapter._insert(props) I get: File "C:\Users\Quint*\gluon\dal.py

[web2py] Re: GAE: insert using "key_name"

2014-01-09 Thread Alan Etkin
> > How about adding support in dal.py for the following: > > # processes the field input and add defaults, computes, etc. (does not > make actual insertion). > >>> values = db._insert(spam="alot", ...) > {"spam": "alot", ...} > I made a pr about supporting _insert for processing values without

[web2py] Re: GAE: insert using "key_name"

2014-01-08 Thread Alan Etkin
How about adding support in dal.py for the following: # processes the field input and add defaults, computes, etc. (does not make actual insertion). >>> values = db._insert(spam="alot", ...) {"spam": "alot", ...} So one can use the output for storing named keys (with app specific logic or maybe

[web2py] Re: GAE: insert using "key_name"

2014-01-08 Thread Alan Etkin
> > Compatible with what? > With any web2py feature expecting entity keys (web2py records) with integer ids. But you would know that you don't need those functionalities if you would > decide to use a key_name > I think this is usually called a "corner case". I would't add the feature for th

[web2py] Re: GAE: insert using "key_name"

2014-01-08 Thread Quint
Sorry, I don't understand this line. although I belive storing records without id assignment would be > restrictive for apps Do you mean web2py apps or GAE apps? What did you mean by "restrictive" (and I doubt it will be actually compatible at all Compatible with what? Sure, when you would

[web2py] Re: GAE: insert using "key_name"

2014-01-08 Thread Alan Etkin
> But does that mean you should not allow it to be inserted that way? > Nothing restricts users from operating (using web2py api) on rows inserted with GAE api There's no restriction on the use of the datastore, since it is not a service reserved for web2py apps, although I belive storing re

[web2py] Re: GAE: insert using "key_name"

2014-01-08 Thread Quint
Yes, Your post reminds me, I forgot something. I thought that when a key_name is used, it could simply return that as an id. But if you say that DAL requires that it returns an integer id, than yes, that would break it. When you use a key_name, the records do not have an numeric id. But does tha

[web2py] Re: GAE: insert using "key_name"

2014-01-08 Thread Alan Etkin
> 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