Ant*_*ton 1 scala cassandra phantom-dsl
我试图在https://github.com/websudos/phantom/blob/develop/phantom-example/src/main/scala/com/websudos/phantom/example/basics/SimpleRecipes.scala上运行这个例子
,所以我创建了一个Recipe并尝试使用它插入insertNewRecord(myRecipe)
并获得以下异常:....InvalidQueryException: unconfigured columnfamily my_custom_table
.我检查了使用cqlsh并创建了密钥空间,但表没有.
所以我的问题是,如何使用幻像创建表格?在任何示例代码中都没有提到这一点,我也无法通过幻像源代码来解决这个问题.
您需要使用模式自动生成创建表.只需执行:
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._
import com.websudos.phantom.dsl._
// To execute this, you need an implicit keySpace and a session.
Await.ready(SimpleRecipes.create.ifNotExists().future(), 3.seconds)
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1643 次 |
最近记录: |