Python using nosql connection mysqlhandlersocket insert operation to get variable value method python
BitsCN.com
Ubuntu11.10 install mysql + handlersocket
Http://www.cnblogs.com/aaronwxb/archive/2012/04/29/2475834.html
What is pyhs? To put it simply, it encapsulates interfaces, implements python to connect to the mysql database in nosql mode, and performs some operations on the database.
Pyhs is a pure Python client (with optional C speedups) for HandlerSocket plugin to MySQL database. in short, it provides access to the data omitting the SQL engine in a NoSQL-like interface. it allows all simple operations (get, insert, update, delete) over indexed data to perform considerably faster than by usual means.
Installation method:
Http://packages.python.org/python-handler-socket/installation.html
Concise tutorial:
Http://packages.python.org/python-handler-socket/usage.html
When entering the topic, it is correct to use variables during the update operation:
1 from pyhs import Manager 2 3 attendant_id = '222' 4 newname = 'wxb' 5 newpwd = '123456' 6 7 hs = Manager() 8 name = '2a' 9 10 data=hs.update('final','kf_attendant','=',['AD_ID','AD_Name','AD_Password'],[attendant_id],[attendant_id,newname,newpwd],None,1,0,True)
However, during the insert operation, the error "SystemError: NULL result without error in PyObject_Call" is reported directly when the variable name is used. The str () function is used to solve the problem ~
1 from pyhs import Manager 2 import uuid 3 4 hs = Manager() 5 6 newid = uuid.uuid1() 7 newname = 'aaa' 8 newpwd = '123' 9 10 hs.insert('final','kf_attendant',[('AD_ID',str(newid)),('AD_Name',str(newname)),('AD_Password',str(newpwd))])
BitsCN.com