[DB-SIG] Question about multi-user access via MySQLdb
S. D. Rose
s_david_rose at hotmail.com
Tue Mar 14 21:09:57 CET 2006
I've found the .change_user() function on the connection, that seems to work
"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.
> are 2 user accounts, USER and MANAGER. There are 2 catalogs, DATA and
> I thought I was real savvy -- I created two connections to the database,
> cursor = conn.cursor() and a privCursor = privConn.cursor(), where
> conn.cursor() is connected with USER and privConn.cursor() is connected
> 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
> 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
> 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
> a .commit() after my:
> .execute(""" DELETE FROM configuredcameras""")
> .executemany(""" INSERT INTO configuredcameras (IPaddress) VALUES (%s)
> (self.cameraList_combo_box.GetStrings() )
> 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
> 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
> 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!!
> DB-SIG maillist - DB-SIG at python.org
More information about the DB-SIG