[web2py] Re: Transactions in Web2Py over Google App Engine.

2012-12-18 Thread José Manuel López Muñoz
Thank you all for the answers, 
I finally have created a function and run it in a transaction.
Regards.

On Thursday, November 29, 2012 11:18:47 AM UTC+1, José Manuel López Muñoz 
wrote:
>
> I'm making a room reservation system in Web2Py over Google App Engine. 
> When a user is booking a Room the system must be sure that this room is 
> really available and no one else have reserved it just a moment before. To 
> be sure I make a query to see if the room is available, then I make the 
> reservation. The problem is how can I do this transaction in a kind of 
> "Mutual exclusion" to be sure that this room is really for this user?
>
> Thank you!! :)
>

-- 





[web2py] Re: Transactions in Web2Py over Google App Engine.

2012-12-01 Thread dlypka
I found this:
https://developers.google.com/appengine/docs/python/datastore/overview#Cross_Group_Transactions
"For example, to increment a counter field in an object, you need to read 
the value of the counter, calculate the new value, and then store it back. 
Without a transaction, it is possible for another process to increment the 
counter between the time you read the value and the time you update it, 
causing your application to overwrite the updated value. Doing the read, 
calculation, and write in a single transaction ensures that no other 
process can interfere with the increment."

On Friday, November 30, 2012 12:19:29 PM UTC-6, Joe Barnhart wrote:
>
> Think hard before locking a table while a user is dawdling over his 
> reservation.
>
> The feature you are dealing with is database "isolation 
> level" 
> and is the subject that fills volumes of database theory.  From what you 
> describe I think you want the "repeatable read" level.  I do not know 
> enough about GAE to tell you which levels it supports.  But here is an 
> article on Google BigTable 
> Isolationwhich
>  may help.
>
> -- Joe B.
>
> On Thursday, November 29, 2012 2:18:47 AM UTC-8, José Manuel López Muñoz 
> wrote:
>>
>> I'm making a room reservation system in Web2Py over Google App Engine. 
>> When a user is booking a Room the system must be sure that this room is 
>> really available and no one else have reserved it just a moment before. To 
>> be sure I make a query to see if the room is available, then I make the 
>> reservation. The problem is how can I do this transaction in a kind of 
>> "Mutual exclusion" to be sure that this room is really for this user?
>>
>> Thank you!! :)
>>
>

-- 





[web2py] Re: Transactions in Web2Py over Google App Engine.

2012-11-30 Thread Joe Barnhart
Think hard before locking a table while a user is dawdling over his 
reservation.

The feature you are dealing with is database "isolation 
level" 
and is the subject that fills volumes of database theory.  From what you 
describe I think you want the "repeatable read" level.  I do not know 
enough about GAE to tell you which levels it supports.

-- Joe B.

On Thursday, November 29, 2012 2:18:47 AM UTC-8, José Manuel López Muñoz 
wrote:
>
> I'm making a room reservation system in Web2Py over Google App Engine. 
> When a user is booking a Room the system must be sure that this room is 
> really available and no one else have reserved it just a moment before. To 
> be sure I make a query to see if the room is available, then I make the 
> reservation. The problem is how can I do this transaction in a kind of 
> "Mutual exclusion" to be sure that this room is really for this user?
>
> Thank you!! :)
>

-- 





[web2py] Re: Transactions in Web2Py over Google App Engine.

2012-11-29 Thread Massimo Di Pierro
GAE does not support transactions across multiple tables. You can put your 
dal code into a function as in

def mydblogic(*args):
  db.insertdb().updatedb(0.select

and run it with

from google.appengine.ext import db as gae
gae.run_in_transaction(mydblogic, *args)

On Thursday, 29 November 2012 04:18:47 UTC-6, José Manuel López Muñoz wrote:
>
> I'm making a room reservation system in Web2Py over Google App Engine. 
> When a user is booking a Room the system must be sure that this room is 
> really available and no one else have reserved it just a moment before. To 
> be sure I make a query to see if the room is available, then I make the 
> reservation. The problem is how can I do this transaction in a kind of 
> "Mutual exclusion" to be sure that this room is really for this user?
>
> Thank you!! :)
>

--