Niphlod, db.commit() did the trick....
Thank you... On Friday, April 1, 2016 at 5:14:24 PM UTC-3, Niphlod wrote: > > can you try to do a db.commit() in the shell AFTER the succesfull update > on mysql's console and BEFORE fetching the record in the shell the second > time ? > > On Friday, April 1, 2016 at 10:07:20 PM UTC+2, Marcello wrote: >> >> Example: >> >> In [1]: k = db.konsulta(3514998) >> >> In [2]: k.ok >> Out[2]: 1L >> >> (I change the ok value of this record id DB in mysql's console (and >> committed it) for 2, for example. >> Then came back to my web2py shell and again: >> >> In [3]: k = db.konsulta(3514998) >> >> In [4]: k.ok >> Out[4]: 1L >> >> If I leave console and repeat that I get: >> >> In [1]: k = db.konsulta(3514998) >> >> In [2]: k.ok >> Out[2]: 2L >> >> >> I'd like to get the updated value (2) without leave and return to >> shell.... >> >> >> Thanks... >> >> >> >> >> On Friday, April 1, 2016 at 5:02:58 PM UTC-3, Niphlod wrote: >>> >>> please clarify. if you fetch it back isn't modified, so how can you tell >>> the data is actually "modified in the DB" ? >>> >>> On Friday, April 1, 2016 at 6:21:46 PM UTC+2, Marcello wrote: >>>> >>>> Yes. Sure... the data is modified in the DB. >>>> >>>> >>>> On Friday, April 1, 2016 at 12:14:51 PM UTC-3, Niphlod wrote: >>>>> >>>>> sure the other process has commit()ed the changes ? that's what >>>>> transactions are for: until a change is commit()ed, no changes are >>>>> visible. >>>>> >>>>> >>>>> BTW: mysql has the weirdest default setting of not allowing to see >>>>> changes from OTHER processes until the process which reads commit()s >>>>> itself >>>>> (which may be your case). >>>>> Try to call db.commit() on the "shell" process even if you didn't >>>>> issue any update() statement yet. The restriction explained earlier still >>>>> applies: if the other process doesn't commit(), your shell will still see >>>>> no changes at all. >>>>> >>>>> On Friday, April 1, 2016 at 5:07:52 PM UTC+2, Marcello wrote: >>>>>> >>>>>> I tried it. >>>>>> It gives me the old value. >>>>>> I have to leave the shell and enter again to refresh it... >>>>>> >>>>>> This is my problem >>>>>> >>>>>> >>>>>> >>>>>> On Friday, April 1, 2016 at 11:53:52 AM UTC-3, Niphlod wrote: >>>>>>> >>>>>>> yep, you need to re-select it ... >>>>>>> >>>>>>> On Friday, April 1, 2016 at 3:26:39 PM UTC+2, Marcello wrote: >>>>>>>> >>>>>>>> Hello, >>>>>>>> >>>>>>>> I have a function that I call in a shell... >>>>>>>> I load a record from a database and do some stuff.. >>>>>>>> >>>>>>>> Problem is that in the meantime the record may be modified in the >>>>>>>> server... >>>>>>>> >>>>>>>> Is there a way to reload the record from the database to track >>>>>>>> possible changes ?? >>>>>>>> (I'm using mysql) >>>>>>>> >>>>>>>> >>>>>>>> Thanks, >>>>>>>> >>>>>>>> Marcello >>>>>>>> >>>>>>> -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

