Slick with Oracle provider codegen

155 views
Skip to first unread message

Ryan Stradling

unread,
May 5, 2015, 2:37:57 PM5/5/15
to scala...@googlegroups.com
I am evaluating using Slick and Akka Streams with Oracle.  The issue I am having is getting code gen to work.

scalaVersion := "2.11.6"

libraryDependencies ++= Seq("com.typesafe.slick" %% "slick" % "3.0.0",
"com.typesafe.slick" %% "slick-extensions" % "3.0.0",
"com.typesafe.akka" %% "akka-stream-experimental" % "1.0-M5",
"com.typesafe.slick" %% "slick-codegen" % "3.0.0",
"ch.qos.logback" % "logback-classic" % "1.1.2",
"org.slf4j" % "slf4j-api" % "1.7.7",
"ojdbc" % "ojdbc" % "14",
"com.zaxxer" % "HikariCP-java6" % "2.3.5"
)

The above are the dependencies,  When running the below code
object SlickCodeGen extends App {

override def main(args : Array[String]) = {
val db = Database.forConfig("app.db.default")
val tables: dbio.DBIO[Seq[MTable]] = OracleDriver.defaultTables
val myTables: dbio.DBIO[Seq[MTable]] = tables.map {
(x : Seq[MTable]) => x.filter { (y : MTable) =>
y.name.name == "TLSN"// && y.tableType == "TABLE"
}
}
val modelAction = OracleDriver.createModel(Some(myTables))
val modelFuture = db.run(modelAction)
val outputFolder = "src/main/scala"
val codegenFuture = modelFuture.map(model =>
new SourceCodeGenerator(model) )
codegenFuture.onSuccess {
case codegen =>
codegen.writeToFile("com.typesafe.slick.driver.oracle.OracleDriver", outputFolder, "com.db.rpl.transformer.generated",
"Tables", "Tables.scala" )
}
Await.result(codegenFuture, 300 minutes)
// val exportSlickDriver = "slick.driver.MySQLDriver"
}
}

The debug logs show that it has a model (i.e. "Model(List(Table(QualifiedName(DSRC...." is printed in the log).  However, there is nothing written out.  There is no file at all.  I had a previous issue where there was empty data but figured out that issue.  I have tried chancing the outputFolder to absolute path, made sure the path exists, etc.  It just seems to die but the error code is 0 upon exiting.  Any help is much appreciated.

Thanks,
Ryan

Eric Richardson

unread,
Jul 6, 2015, 3:35:12 PM7/6/15
to scala...@googlegroups.com
Hi Ryan,
I know this post is pretty old but I did something similar here that works but the code generated doesn't compile.
Perhaps myTables is empty?
Eric
Reply all
Reply to author
Forward
0 new messages