ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> db-sig
db-sig
[DB-SIG] Question about multi-user access via MySQLdb
by S. D. Rose other posts by this author
Mar 14 2006 9:02AM messages near this date
[DB-SIG] pyodbc 2.x released | Re: [DB-SIG] Question about multi-user access via MySQLdb
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@[...].org
http://mail.python.org/mailman/listinfo/db-sig
Thread:
S. D. Rose
S. D. Rose
Jekabs Andrushaitis

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved