You are viewing a plain text version of this content. The canonical link for it is here.
Posted to client-dev@cassandra.apache.org by Juarez Bochi <jb...@gmail.com> on 2014/07/09 23:32:33 UTC

Lua CQL driver

Hi,

I have started the development of a cassandra cql driver in Lua.

The code is available at https://github.com/jbochi/lua-resty-cassandra.

It is missing some features
<https://github.com/jbochi/lua-resty-cassandra/issues?state=open> and lacks
support for several types
<https://github.com/jbochi/lua-resty-cassandra/issues/16>but is already
usable:

      session = cassandra.new()
      session:set_timeout(1000)
      connected, err = session:connect("127.0.0.1", 9042)

      session:set_keyspace("lua_tests")

      local table_created, err = session:execute([[
          CREATE TABLE users (
            user_id uuid PRIMARY KEY,
            name varchar,
            age int
          )
      ]])

      local ok, err = session:execute([[
        INSERT INTO users (name, age, user_id)
        VALUES (?, ?, ?)
      ]], {"Juarez S' Bochi", 31, {type="uuid",
value="1144bada-852c-11e3-89fb-e0b9a54a6d11"}})
      local users, err = session:execute("SELECT name, age, user_id from
users")
      assert.same(1, #users)
      local user = users[1]
      assert.same("Juarez S' Bochi", user.name)
      assert.same("1144bada-852c-11e3-89fb-e0b9a54a6d11", user.user_id)
      assert.same(31, user.age)
      assert.truthy(ok)


Contributions and suggestions are welcome!

https://github.com/jbochi/lua-resty-cassandra

Thanks,
Juarez Bochi

Re: Lua CQL driver

Posted by Juarez Bochi <jb...@gmail.com>.
Thank you, Tyler.
On Jul 9, 2014 6:43 PM, "Tyler Hobbs" <ty...@datastax.com> wrote:

> Awesome!  I've added it to the Wiki list of drivers here:
> https://wiki.apache.org/cassandra/ClientOptions
>
> You should also mention this on the Cassandra user mailing list.
>
>
> On Wed, Jul 9, 2014 at 4:32 PM, Juarez Bochi <jb...@gmail.com> wrote:
>
> > Hi,
> >
> > I have started the development of a cassandra cql driver in Lua.
> >
> > The code is available at https://github.com/jbochi/lua-resty-cassandra.
> >
> > It is missing some features
> > <https://github.com/jbochi/lua-resty-cassandra/issues?state=open> and
> > lacks
> > support for several types
> > <https://github.com/jbochi/lua-resty-cassandra/issues/16>but is already
> > usable:
> >
> >       session = cassandra.new()
> >       session:set_timeout(1000)
> >       connected, err = session:connect("127.0.0.1", 9042)
> >
> >       session:set_keyspace("lua_tests")
> >
> >       local table_created, err = session:execute([[
> >           CREATE TABLE users (
> >             user_id uuid PRIMARY KEY,
> >             name varchar,
> >             age int
> >           )
> >       ]])
> >
> >       local ok, err = session:execute([[
> >         INSERT INTO users (name, age, user_id)
> >         VALUES (?, ?, ?)
> >       ]], {"Juarez S' Bochi", 31, {type="uuid",
> > value="1144bada-852c-11e3-89fb-e0b9a54a6d11"}})
> >       local users, err = session:execute("SELECT name, age, user_id from
> > users")
> >       assert.same(1, #users)
> >       local user = users[1]
> >       assert.same("Juarez S' Bochi", user.name)
> >       assert.same("1144bada-852c-11e3-89fb-e0b9a54a6d11", user.user_id)
> >       assert.same(31, user.age)
> >       assert.truthy(ok)
> >
> >
> > Contributions and suggestions are welcome!
> >
> > https://github.com/jbochi/lua-resty-cassandra
> >
> > Thanks,
> > Juarez Bochi
> >
>
>
>
> --
> Tyler Hobbs
> DataStax <http://datastax.com/>
>

Re: Lua CQL driver

Posted by Tyler Hobbs <ty...@datastax.com>.
Awesome!  I've added it to the Wiki list of drivers here:
https://wiki.apache.org/cassandra/ClientOptions

You should also mention this on the Cassandra user mailing list.


On Wed, Jul 9, 2014 at 4:32 PM, Juarez Bochi <jb...@gmail.com> wrote:

> Hi,
>
> I have started the development of a cassandra cql driver in Lua.
>
> The code is available at https://github.com/jbochi/lua-resty-cassandra.
>
> It is missing some features
> <https://github.com/jbochi/lua-resty-cassandra/issues?state=open> and
> lacks
> support for several types
> <https://github.com/jbochi/lua-resty-cassandra/issues/16>but is already
> usable:
>
>       session = cassandra.new()
>       session:set_timeout(1000)
>       connected, err = session:connect("127.0.0.1", 9042)
>
>       session:set_keyspace("lua_tests")
>
>       local table_created, err = session:execute([[
>           CREATE TABLE users (
>             user_id uuid PRIMARY KEY,
>             name varchar,
>             age int
>           )
>       ]])
>
>       local ok, err = session:execute([[
>         INSERT INTO users (name, age, user_id)
>         VALUES (?, ?, ?)
>       ]], {"Juarez S' Bochi", 31, {type="uuid",
> value="1144bada-852c-11e3-89fb-e0b9a54a6d11"}})
>       local users, err = session:execute("SELECT name, age, user_id from
> users")
>       assert.same(1, #users)
>       local user = users[1]
>       assert.same("Juarez S' Bochi", user.name)
>       assert.same("1144bada-852c-11e3-89fb-e0b9a54a6d11", user.user_id)
>       assert.same(31, user.age)
>       assert.truthy(ok)
>
>
> Contributions and suggestions are welcome!
>
> https://github.com/jbochi/lua-resty-cassandra
>
> Thanks,
> Juarez Bochi
>



-- 
Tyler Hobbs
DataStax <http://datastax.com/>

Re: Lua CQL driver

Posted by Lewis John Mcgibbney <le...@gmail.com>.
BOOM


On Wed, Jul 9, 2014 at 5:32 PM, Juarez Bochi <jb...@gmail.com> wrote:

> Hi,
>
> I have started the development of a cassandra cql driver in Lua.
>
> The code is available at https://github.com/jbochi/lua-resty-cassandra.
>
> It is missing some features
> <https://github.com/jbochi/lua-resty-cassandra/issues?state=open> and
> lacks
> support for several types
> <https://github.com/jbochi/lua-resty-cassandra/issues/16>but is already
> usable:
>
>       session = cassandra.new()
>       session:set_timeout(1000)
>       connected, err = session:connect("127.0.0.1", 9042)
>
>       session:set_keyspace("lua_tests")
>
>       local table_created, err = session:execute([[
>           CREATE TABLE users (
>             user_id uuid PRIMARY KEY,
>             name varchar,
>             age int
>           )
>       ]])
>
>       local ok, err = session:execute([[
>         INSERT INTO users (name, age, user_id)
>         VALUES (?, ?, ?)
>       ]], {"Juarez S' Bochi", 31, {type="uuid",
> value="1144bada-852c-11e3-89fb-e0b9a54a6d11"}})
>       local users, err = session:execute("SELECT name, age, user_id from
> users")
>       assert.same(1, #users)
>       local user = users[1]
>       assert.same("Juarez S' Bochi", user.name)
>       assert.same("1144bada-852c-11e3-89fb-e0b9a54a6d11", user.user_id)
>       assert.same(31, user.age)
>       assert.truthy(ok)
>
>
> Contributions and suggestions are welcome!
>
> https://github.com/jbochi/lua-resty-cassandra
>
> Thanks,
> Juarez Bochi
>



-- 
*Lewis*