1

我正在尝试在https://github.com/websudos/phantom/blob/develop/phantom-example/src/main/scala/com/websudos/phantom/example/basics/SimpleRecipes.scala上运行示例 ,所以我创建了一个食谱并尝试使用它插入它insertNewRecord(myRecipe)并得到以下异常:....InvalidQueryException: unconfigured columnfamily my_custom_table。我使用 cqlsh 检查并创建了密钥空间,但没有创建表。

所以我的问题是,如何使用幻像创建表格?这在任何示例代码中都没有提到,我也无法通过查看幻像源代码来弄清楚。

4

1 回答 1

5

您需要使用模式自动生成来创建表。只需执行:

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)
于 2015-07-13T23:17:30.960 回答