On Sat, Feb 21, 2009 at 11:44 PM, Yarko Tymciurak <yark...@gmail.com> wrote:

> I may be missing something (I have just started to read this)  but I have a
> fundamental question:
> It seems to me entity groups (no matter how "limited" you consider them)
> are also useful and critical for things like updating, say, a user
> registration to a conference which may very well involve more than one table
> item:
>
> person.id and registration.id and payment.id and coupon.id  (for example).
>



you are right... without entity groups you do not have transactions.... and
therefore you must  implement the rollback programmatically (mmmm..... bad
!!!!)




>
> It seems to me "entity group" is a useful concept that should scale accross
> to SQL dbs in some way also.  By not abstracting this appropriately, it
> seems we are creating (practically looking at this) more limitations than
> GAE has in reality.
>



you are right on that. GAE introduces a lot of limitations in change of some
great benefits... to overcome (partially) those limitations we need to use
all what GAE can offer.... otherwise we get limited twice !




>
> Am I missing something?
>


probably we can use web2py as long as it help us reducing the
coding/maintaining time... and complement it with  GAE API bypassing the
DAL....



>
> Thanks,
> Yarko
>
> On Fri, Feb 20, 2009 at 11:33 AM, Robin B <robi...@gmail.com> wrote:
>
>>
>> The only easy way to set parent= is to bypass the DAL, because you do
>> not get easy access to the google key for the entity that is needed to
>> set a parent=.
>>
>> To use Google specific stuff, you can use the gae_db.Model directly.
>>
>> To effectively use Google logins, you *must* use gae_db.UserProperty
>> (users can change the email associated with their google account, so
>> it is the only way to reliably/uniquely identify a user).
>>
>> For example, I use this for Google users on http://ru.ly:
>>
>> class GaeUsers(gae_db.Model):
>>  user = gae_db.UserProperty()
>>  created_at = gae_db.DateTimeProperty(auto_now_add=True)
>>
>> def get_current_user():
>>  user = gae_users.get_current_user()
>>  local_user = None
>>  if user:
>>    local_user = GaeUsers.all().filter('user =',user).get()
>>    if local_user is None:
>>      local_user = GaeUsers(user=user)
>>      local_user.put()
>>  return local_user
>>
>>
>> Robin
>>
>>
>> On Feb 20, 11:13 am, "Sebastian E. Ovide" <sebastianov...@gmail.com>
>> wrote:
>> > On Fri, Feb 20, 2009 at 12:36 AM, Robin B <robi...@gmail.com> wrote:
>> >
>> > > I have the transactions working, but it is not fully compatible with
>> > > web2py DAL, but it could be soon ( needs type coercion, db.table.ALL,
>> > > etc)  Also in web2py, you cannot set the entity group when inserting,
>> > > so transactions will only involve 1 record.  (eg atomically read/
>> > > modify/write a counter in a transaction)
>> >
>> > that is great, at least we can do counters !...
>> >
>> > and how could we specify a parent in a antity with web2py ? is there any
>> > simple way ?
>> >
>> > thanks !
>> >
>> >
>> >
>> > > If you needed transactions immediately, you could do this:
>> >
>> > > from google.appengine.ext import gdb
>> >
>> > > def txn():
>> > >  post = db.posts[post_id]
>> > >  post.update_record(title='foo')
>> > >  return post
>> >
>> > > post = gdb.run_in_transaction(txn)
>> >
>> > > On a side note, I have batch operations working too. But I recently
>> > > read that batch operations are just O(n), which unfortunately means no
>> > > joins or efficient batch operations will be possible for now, but I
>> > > have not benchmarked it on the real google datastore to know for sure.
>> >
>> > > Robin
>> >
>> > > On Feb 19, 3:31 pm, sebastian <sebastianov...@gmail.com> wrote:
>> > > > Hi All,
>> >
>> > > > is there any schedule for the GAE transactions/entity groups ?
>> >
>> > > > if not, how would it be the best way (web2py upgrades compatible !)
>> to
>> > > > use entity groups and transaction with web2py ?
>> >
>> > > > thanks
>> >
>> > > > On Jan 19, 2:59 pm, Robin B <robi...@gmail.com> wrote:
>> >
>> > > > > > Groups under the DAL to be a single record. Since Big Table
>> > > > > > transactions are limited to one Entity Group pertransaction,
>> this
>> > > > > > means that we are limited to one record pertransaction. Right?
>> >
>> > > > > You have it right.
>> >
>> > > > > > In the example above, 'count' is just an example of some
>> arbitrary
>> > > > > > column in the record, right? Can I have multiple assignments?
>> Can I
>> > > > > > mix lambda and non-lambda assignments? E.g.:
>> >
>> > > > > >     row.update_record(count=lambda r: r.count+1,
>> vote_score=lambda r:
>> > > > > > calculate_vote_score(), preference='blue')
>> >
>> > > > > Yes, you would be able to mix lamdas/functions and values.
>> >
>> > > > > On the subject of passing lamdas as attributes, the field.default=
>> > > > > should also recognize any lambda/callable and call it on demand:
>> >
>> > > > > def uuid():
>> > > > >   import uuid
>> > > > >   return uuid.uuid4()
>> >
>> > > > > db.table.created_at.default=t2.now
>> > > > > db.table.uuid.default=uuid
>> >
>> > > > > Robin
>>
>>
>
> >
>

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

Reply via email to