Python connects to mysqlhandlersocket insert using nosql to obtain the variable value _ MySQL

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.