python 以nosql方式连接mysql handlersocket插入操作获得变量值方法
2012-05-04 20:51
921 查看
ubuntu11.10安装mysql+handlersocket
/article/7079515.html
何为pyhs?简单来说,就是封装了接口,实现python以nosql方式连接mysql数据库,对数据库进行一些操作。
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.
安装方法:
http://packages.python.org/python-handler-socket/installation.html
简明教程:
http://packages.python.org/python-handler-socket/usage.html
进入主题,在update操作时,使用变量是没错的:
但是进行insert操作时,直接使用变量名就一直出错“SystemError: NULL result without error in PyObject_Call”,结果使用str()函数解决了~
/article/7079515.html
何为pyhs?简单来说,就是封装了接口,实现python以nosql方式连接mysql数据库,对数据库进行一些操作。
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.
安装方法:
http://packages.python.org/python-handler-socket/installation.html
简明教程:
http://packages.python.org/python-handler-socket/usage.html
进入主题,在update操作时,使用变量是没错的:
from pyhs import Manager attendant_id = '222' newname = 'wxb' newpwd = '123456' hs = Manager() name = '2a' data=hs.update('final','kf_attendant','=',['AD_ID','AD_Name','AD_Password'],[attendant_id],[attendant_id,newname,newpwd],None,1,0,True)
但是进行insert操作时,直接使用变量名就一直出错“SystemError: NULL result without error in PyObject_Call”,结果使用str()函数解决了~
from pyhs import Manager import uuid hs = Manager() newid = uuid.uuid1() newname = 'aaa' newpwd = '123' hs.insert('final','kf_attendant',[('AD_ID',str(newid)),('AD_Name',str(newname)),('AD_Password',str(newpwd))])
相关文章推荐
- Python实现MySQL操作的方法小结【安装,连接,增删改查等】
- Python2.7简单连接与操作MySQL的方法
- Python2.7简单连接与操作MySQL的方法
- HandlerSocket系列(MySQL的NoSQL插件HandlerSocket)
- 使用 Python 连接 MySQL 的方法
- 基础--JAVA对Mysql进行连接、插入、修改、删除操作
- Python操作MySQL简单实现方法
- JDBC连接Mysql实现数据的插入、更改操作
- HandlerSocket client for java——MySql as NoSQL
- python使用socket连接远程服务器的方法
- linux安装mysql和使用c语言操作数据库的方法 c语言连接mysql
- python使用socket连接远程服务器的方法
- MySQL-python连接socket问题
- 连接远程服务器上的mysql会出现的问题和解决方式(账号设置等操作)
- C++操作MySQL大量数据插入效率低下的解决方法
- MySQL官方文档推荐的一个Python连接MySQL的方法—mysql.connector
- php连接不上mysql但mysql命令行操作正常的解决方法
- Python爬虫数据存储MySQL【1】连接方式
- 利用pandas连接mysql,oracle数据库进行查询和插入操作
- 连接Mysql提示Can’t connect to local MySQL server through socket的解决方法