[DB-SIG] Question about multi-user access via MySQLdb
S. D. Rose
s_david_rose at hotmail.com
Tue Mar 14 17:46:08 CET 2006
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
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""")
.executemany(""" INSERT INTO configuredcameras (IPaddress) VALUES (%s) """,
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!!
More information about the DB-SIG