Search code examples
pythonmysqlhandlersocket

Python-handler-socket (pyhs) update function example


I'm using the Python client library for the HandlerSocket MySQL plugin (https://bitbucket.org/excieve/pyhs/overview). I can make insert and find requests, but I can't find example of how to call manager.update() function. I've read through the docs of the library and googled a lot, but no luck. Please anybody give me code a example how to work with update function.


Solution

  • I used code example for the find function (http://python-handler-socket.readthedocs.org/en/latest/usage.html#high-level) to make the update function call

    # UPDATE mydb.test1 SET Cnt=5 WHERE Id=1    
    hs.update('mydb', 'test1', '=', ['Id', 'Cnt'], ['1'], ['1', '5'])
    

    Please put attention that the test1.Id column is INTEGER, but I must search it as string '1'