Search code examples
scalacassandraphantom-dsl

How does Phantom DSL for Cassandra actually connect?


I'd like to use the Phantom DSL for Cassandra from Scala. I've noted that it uses the Datastax Java driver underneath, but I don't see anything in the documentation about how to actually connect or configure a connection. The included tests use an embedded Cassandra, so that doesn't help. Are there any detailed examples or tutorials for this library?


Solution

  • To run operations with Phantom "tables" you need to have implicit Session object in scope. One way to achieve that is CassandraConnector, and you can build connectors using ContactPoint. For instance you can use this example.

    Or you can build your own way of initializing implicit Session.

    Update

    Additionally you can read about connectors in more depth on this blog post.