I am new in both scala and cassandra . I know the connectivity of cassandra with java using hector . But I don\'t know how to connect cassandra through scala. I want a simple ex
I have found some articles (example) and Maga library showing how you could integrate Java Driver better with Scala and it did not look hard.
The result is my own library that you can find on GitHub: https://github.com/atais/scassandra
It allows for seamless integration in Scala for both CQL
queries and manipulating the ListenableFuture
without mapping it into scala.Future
.
implicit protected val session: com.datastax.driver.core.Session
implicit protected val executor: java.util.concurrent.Executor
val selectCQL: ListenableFuture[PreparedStatement] = cql"SELECT * FROM $table WHERE key = ?"
val result: ListenableFuture[ResultSet] = execute(selectCQL, "my-key")
result.map(rs => rs.one())
.map(...)
Enjoy :)