Created
June 21, 2013 13:33
-
-
Save kristiankime/5831162 to your computer and use it in GitHub Desktop.
A quick example of how to load a CSV file via slick and then print the contents using Slick's raw SQL commands.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object SimpleExample { | |
def main(args: Array[String]) { | |
Database.forURL("jdbc:h2:mem:working_data;DB_CLOSE_DELAY=-1", driver = "org.h2.Driver") withSession { | |
Q.updateNA("CREATE TABLE DATA_TABLE AS SELECT * FROM CSVREAD('data/data.csv');").execute | |
Q.queryNA("SELECT * FROM DATA_TABLE")(GetResult(r => (r.nextString, r.nextString, r.nextString))).foreach(println(_)) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment