Questions tagged [slick-3.0]

Slick is a modern database query and access library for Scala by Typesafe.

Slick is a modern database query and access library for Scala. It allows you to work with stored data almost as if you were using Scala collections while at the same time giving you full control over when a database access happens and which data is transferred. You can write your database queries in Scala instead of SQL, thus profiting from the static checking, compile-time safety and compositionality of Scala. Slick features an extensible query compiler which can generate code for different backends.

New in Slick 3.0.0-M1

These are the major new features in this miletone:

  • A new API for composing and executing database actions.
  • Improved configuration of database connections via Typesafe Config, including built-in support for HikariCP.
  • Support for nested Option types and non-primtive Option types in the Lifted Embedding.
  • Properly typed outer join operators based on the improved Option support.

Useful Links

479 questions
0
votes
1 answer

Scala Play and Slick. Writing Form Mapping and Database Mapping for an object

I am using Slick 3.0 inside of Play. I have this small class for which I have written database mapping case class Person(id: Int, firstname: String, lastname: String) class People(tag: Tag) extends Table[Person](tag, "PEOPLE") { def id =…
Knows Not Much
  • 26,151
  • 46
  • 158
  • 314
0
votes
1 answer

Play 2.4 Slick 3.0 - Delete all rows in table

I'm using Slick 3.0 to access a PostgreSQL database in Play 2.4 and need a way to delete all rows from a table without dropping it. Deleting single rows works: lazy val tasks = TableQuery[Tasks] def delete(id: Long) = db.run(tasks.filter(_.id ===…
0
votes
1 answer

Race condition in Slick Code

I have written this slick DAO and its unit test in specs2. My code has race conditions. When I run the same tests, I get different outputs. The race conditions exist even though in both the functions I do Await.result(future,…
Knows Not Much
  • 26,151
  • 46
  • 158
  • 314
0
votes
1 answer

Writing UnitTests for Slick DAO

I wrote a simple Slick DAO and I am trying to write unit test for the DAO This is the code for my DAO package tables import slick.driver.H2Driver.api._ import scala.concurrent.ExecutionContext.Implicits.global import play.api.Play.current case…
Knows Not Much
  • 26,151
  • 46
  • 158
  • 314
0
votes
1 answer

Slick 3.0 (scala) queries don't return data till they are run multiple times (I think)

So I'm very (extremely) new to Databases and slick and scala, so I was using the example code from their documentation at http://slick.typesafe.com/doc/3.0.0/gettingstarted.html My problem is that for some reason, I have to run a query multiple…
S2C
  • 53
  • 1
  • 10
0
votes
1 answer

Common type for Query or DBIOAction

I'm trying to pass a query or action as a parameter to a method. The reason is I want to run the same actions on the result of different queries on the same table. For example: val query1 = listItems val query2 = listItems.filter { x => x.id===1…
Ixx
  • 29,955
  • 39
  • 123
  • 217
0
votes
1 answer

play-slick 1.0.0: Cannot define column with type of java.sql.Date

I'm currently trying to define a slick schema as follows using play-framework 2.4.0-RC5 together with play-slick 1.0.0-RC3: import java.sql.Date import play.api.Play import play.api.db.slick.{DatabaseConfigProvider, HasDatabaseConfig} import…
Roman
  • 5,323
  • 1
  • 27
  • 39
0
votes
1 answer

In Slick 2.x/3.x, where should I place extra Static methods associated with a Table?

In the upgrade guide of Slick 3.0, I found contents like this: In Slick 1.0 it was common practice to place extra static methods associated with a table into that table’s object. You can do the same in 2.0 with a custom TableQuery object:…
Hanfei Sun
  • 39,245
  • 33
  • 107
  • 208
0
votes
4 answers

Conditional drop of tables in slick

Any idea how to do a conditional drop in Slick 3.0, to prevent An exception or error caused a run to abort: Unknown table 'MY_TABLE' if for some reason it doesn't exist? def clear = { val operations = DBIO.seq( myTable.schema.drop, …
LuGo
  • 4,620
  • 1
  • 15
  • 19
0
votes
2 answers

How to manage Slick 3.0.0 Database instances in Play Framework

I was wondering how is the right way to manage Slick 3 (3.0.0-RC3 at this moment) database instances in a Play Framework 2.3.x application. According to the upgrade guide, each instance has a connection pool associated. My guess is that I should…
Guillermo Gutiérrez
  • 15,624
  • 15
  • 82
  • 108
0
votes
1 answer

How to find the type of a value that has been implicitly converted?

I'm trying to pull the following code out of a class into a trait for reuse: import org.slf4j.{LoggerFactory, Logger} import slick.driver.H2Driver.api._ import scala.concurrent.Await import scala.concurrent.duration.Duration object…
jbrown
  • 5,873
  • 9
  • 56
  • 101
0
votes
1 answer

Slick 3.0.0 and Scala 2.10.4

I was trying to create a scala program with slick 3.0 and I am getting the following error: Error:scalac: bad symbolic reference. A signature in BasicDriver.class refers to term typesafe in package com which is not available. It may be completely…
Scala fan
  • 1
  • 1
-1
votes
1 answer

Slick Transactionally future is not invoked in Play for Scala

The code below prints '1' and never prints '2', as a result the browser hangs when it requests the page served by the index method. The future is never invoked. If the future.map statement is replaced with Await.result(future, Duration.Inf) the code…
ps0604
  • 2,125
  • 16
  • 88
  • 233
-2
votes
1 answer

How to make a query in Slick 3 to select from DB with count from children tables

How I can make this query in slick 3.0 ? Select *,(SELECT COUNT(*) from flashcards WHERE setId = flashcards_sets.id ) as allCount,(SELECT COUNT(*) from flashcards WHERE studied = true AND setId = flashcards_sets.id ) as studiedCount FROM…
Maxim Cherkasov
  • 115
  • 1
  • 6
1 2 3
31
32