Actions
Bug #4275
opensinedon querying to leginondb instead of appiondb
Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
07/01/2016
Due date:
% Done:
0%
Estimated time:
Affected Version:
Appion/Leginon 3.2
Show in known bugs:
No
Workaround:
Description
File "/tank/software/myami-3.2/appion/bin/makestack2.py", line 1142, in postLoopFunctions apStackMeanPlot.makeStackMeanPlot(stackid) File "/tank/software/myami-3.2/appion/appionlib/apStackMeanPlot.py", line 53, in makeStackMeanPlot partdatas = sinedon.directq.complexMysqlQuery('appiondata',sqlcmd) File "/tank/software/myami-3.2/sinedon/directq.py", line 24, in complexMysqlQuery results = cur.selectall(query) File "/tank/software/myami-3.2/sinedon/sqldb.py", line 44, in selectall self.c.execute(strSQL, param) File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute self.errorhandler(self, exc, value) File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler raise errorclass, errorvalue _mysql_exceptions.ProgrammingError: (1146, "Table 'leginondb.ApStackParticleData' doesn't exist")
Note it says <b>'leginondb.ApStackParticleData'</b>
I checked the code and had it print the info:
sqlcmd = "SELECT " + \ "particleNumber, mean, stdev " + \ "FROM ApStackParticleData " + \ "WHERE `REF|ApStackData|stack` = %i"%(stackid) print sinedon.getConfig('appiondata') partdatas = sinedon.directq.complexMysqlQuery(newdbname, sqlcmd)
{'passwd': 'xxxx', 'host': '127.0.0.1', 'db': 'ap9', 'user': 'usr_object'} connecting
any ideas? this is the northwestern install using myami 3.2 under debian 8.
Updated by Anchi Cheng over 8 years ago
Mayve the sql connection cursor got set to leginondb during force insert of ApStackParticleData some how that was not in the older version.
Can you try if adding something like this to sinedon directq.py getConnection function will help ?
dbname = param['db'] connections[modulename[.dbConnection.select_db(dbname) return connections[modulename]
Updated by Neil Voss over 8 years ago
I was not sure how to implement the commands you have above, but I did this for a test case:
Appion v3.2
module load appion #v3.2 python import sinedon import sinedon.directq from appionlib import apProject newdbname = apProject.getAppionDBFromProjectId(1) sinedon.setConfig('appiondata', db=newdbname) sinedon.getConfig('appiondata') sqlcmd = "SELECT particleNumber FROM ApStackParticleData LIMIT 10;" results = sinedon.directq.complexMysqlQuery('appiondata',sqlcmd)
output:
>>> import sinedon >>> import sinedon.directq >>> from appionlib import apProject >>> newdbname = apProject.getAppionDBFromProjectId(1) >>> sinedon.setConfig('appiondata', db=newdbname) {'passwd': 'xxxxx', 'host': '127.0.0.1', 'db': 'ap1', 'user': 'usr_object'} >>> sinedon.getConfig('appiondata') {'passwd': 'xxxxx', 'host': '127.0.0.1', 'db': 'ap1', 'user': 'usr_object'} >>> sqlcmd = "SELECT particleNumber FROM ApStackParticleData LIMIT 10;" >>> results = sinedon.directq.complexMysqlQuery('appiondata',sqlcmd) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/tank/software/myami-3.2/sinedon/directq.py", line 24, in complexMysqlQuery results = cur.selectall(query) File "/tank/software/myami-3.2/sinedon/sqldb.py", line 44, in selectall self.c.execute(strSQL, param) File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute self.errorhandler(self, exc, value) File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler raise errorclass, errorvalue _mysql_exceptions.ProgrammingError: (1146, "Table 'leginondb.ApStackParticleData' doesn't exist")
Appion 3.1 (also works with beta and trunk)
module load appion-3.1 #v3.1 python import sinedon import sinedon.directq from appionlib import apProject newdbname = apProject.getAppionDBFromProjectId(1) sinedon.setConfig('appiondata', db=newdbname) sinedon.getConfig('appiondata') sqlcmd = "SELECT particleNumber FROM ApStackParticleData LIMIT 10;" results = sinedon.directq.complexMysqlQuery('appiondata',sqlcmd)
output:
Python 2.7.9 (default, Mar 1 2015, 12:57:24) [GCC 4.9.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sinedon >>> import sinedon.directq >>> from appionlib import apProject >>> newdbname = apProject.getAppionDBFromProjectId(1) >>> sinedon.setConfig('appiondata', db=newdbname) {'passwd': 'xxxx', 'host': '127.0.0.1', 'db': 'ap1', 'user': 'usr_object'} >>> sinedon.getConfig('appiondata') {'passwd': 'xxxx', 'host': '127.0.0.1', 'db': 'ap1', 'user': 'usr_object'} >>> sqlcmd = "SELECT particleNumber FROM ApStackParticleData LIMIT 10;" >>> results = sinedon.directq.complexMysqlQuery('appiondata',sqlcmd) connecting
I am not sure what makes Appion v3.2 so special as to fail, whereas 3.1, beta, and trunk all work.
Actions