Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Thibault Charbonnier
    @thibaultcha
    In the next few weeks
    ndileep
    @ndileep
    Hi thibaultCha, isn't this a valid syntax to delete a row?
    ok, err = session:execute("delete from kms.keynames where keyname = (?)", {kn})
    kn is of type string and has a valid value
    I am getting ok as nil
    ndileep
    @ndileep
    Code snippet is
                local cassandra = require "cassandra"
    
                local session = cassandra:new()
                session:set_timeout(1000) -- 1000ms timeout
    
                local connected, err = session:connect("127.0.0.1", 9042)
                assert(connected)
    
                local keyname, err = session:execute("select keyname from kms.keynames limit 1")
                if (#keyname == 1) then
                        kn = keyname[1].keyname
                        ok, err = session:execute("delete from kms.keynames where keyname = (?)", {kn})
                end
                session:close()
    Thibault Charbonnier
    @thibaultcha
    why the parenthesis around “?” ?
    The docs does show proper examples.
    I’m not sure it’s valid
    If you want a map use ? but with cassandra.map(…)
    as the binded value
    ndileep
    @ndileep
    Thanks!
    For nginx-lua-cassandra environment, is there any good library available for DB connection pool or we have build our own?
    Thibault Charbonnier
    @thibaultcha
    http://thibaultcha.github.io/lua-cassandra/examples/basic.lua.html Here you can see cassandra.uuid() as a binded value. It also works with .map, .list, etc...
    Also ok and kn are global variables in your code, be careful.
    ndileep
    @ndileep
    ok, thanks
    I'll test your retry/LB policies when it is ready :-)
    ndileep
    @ndileep
    When we insert a row, like... ok, err = session:execute
    ok, err = session:execute("insert into ...")
    is there a way to know from ok and err, if the row was already existing (since Cassandra does an upsert)?
    Thibault Charbonnier
    @thibaultcha
    No

    From the specs:

    "The rest of the body for a Void result is empty. It indicates that a query was successful without providing more information."

    Void results are what the binary protocol returns for INSERTs
    ysfkc
    @ysfkc
    hi