Trying to import MySQL DUMP using Slick (Scala)

234 views Asked by At

I'm trying to create a self-contained Database test using scalatest. In order to do that, since I have a pretty complex table structure, I want to read the entire SQLdump and execute it using a plain SQL query in Slick, using the sqlu interpolator.

What I'm trying to do looks like:

val db = Database.forURL("jdbc:mysql://localhost:3306/test", driver="driver=\"com.mysql.jdbc.Driver\"", user="root", password="root")
val sqlString = io.Source.fromFile(getClass.getResource("/Test-Setup.sql").getPath).mkString
db.run(sqlu"""$sqlString.result""")

But it seems that's not the proper way to do it.

My question is: How could I import an SQL dump using Slick?

Thank you!

0

There are 0 answers