[DB-SIG] Question about multi-user access via MySQLdb

Jekabs Andrushaitis jekabs.andrusaitis at tietoenator.com
Mon Mar 20 13:16:22 CET 2006


Hello,
did you do the commit on the other connection (USER one) as well? 
According to my understanding on typical transaction separation you 
should do commits on BOTH connections after modifying data in one of 
them if you want to see the new data in other. Basically with 
transactional databases you will see the data as it was first time you 
select it from calling session (or the way you modified it from calling 
session), while other sessions are completely isolated and their data 
wont get to you even if they perform a commit.

Jekabs

S. D. Rose wrote:
> I've found the .change_user() function on the connection, that seems to work
> fine.
>
> -Dave
> "S. D. Rose" <s_david_rose at hotmail.com> wrote in message
> news:dv6s4e$nba$1 at sea.gmane.org...
>   
>> Hello all.
>>   I have a python program which reads configs from a MySQL database.
>>     
> There
>   
>> are 2 user accounts, USER and MANAGER.    There are 2 catalogs, DATA and
>> CONFIG.
>>
>>   I thought I was real savvy -- I created two connections to the database,
>>     
> a
>   
>> cursor = conn.cursor() and a privCursor = privConn.cursor(), where
>> conn.cursor() is connected with USER and privConn.cursor() is connected
>>     
> with
>   
>> MANAGER, thus when a config. change is required, a login box pops up, I
>> login with MANAGER, do the change, then close the login box.  I thought
>>     
> that
>   
>> would allow me to then view-only at any time, and modify with a password.
>>
>>   My problem is that after I modify the config fields of the CONFIG
>>     
> catalog
>   
>> with MANAGER, then scan them with USER (So I can re-populate my combo-box
>> with updated info) I always get the old data from a .fetchall().  I've
>>     
> done
>   
>> a .commit() after my:
>> .execute(""" DELETE FROM configuredcameras""")
>> .commit()
>> .executemany(""" INSERT INTO configuredcameras (IPaddress) VALUES (%s)
>>     
> """,
>   
>> (self.cameraList_combo_box.GetStrings() )
>> .commit()
>>
>> I've also done a time.sleep(1) just to make sure I wasn't querying the
>> database too quickly, but still I get the old data.  however, if I close
>>     
> the
>   
>> program and re-start, I get the data upon initializing the program.
>>
>> Also, using the Graphical Query tool from the MySQL site right after I do
>> this DELETE / INSERT INTO, I see the data in the table.
>>
>> I just don't get it!
>>
>> Ahh, but if I create a 'new' connection to the database as 'USER', I can
>>     
> see
>   
>> the data right after inserting it.
>> Can I 'Refresh' the USER connection I made to the database BEFORE I had
>> logged into the database as MANAGER?  Or, do I have to close the MANAGER
>> connection and re-connect via USER?
>>
>> Any help is greatly appreciated!!
>> Dave
>>
>>
>>
>> _______________________________________________
>> DB-SIG maillist  -  DB-SIG at python.org
>> http://mail.python.org/mailman/listinfo/db-sig
>>
>>     
>
>
>
> _______________________________________________
> DB-SIG maillist  -  DB-SIG at python.org
> http://mail.python.org/mailman/listinfo/db-sig
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/db-sig/attachments/20060320/1a5466d7/attachment.html 


More information about the DB-SIG mailing list