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

488 questions
2
votes
1 answer

How to make a union query of two different entities in Slick?

I want to make a query that combines the list of two different entities into a single list. My plan was to use Options: // +------+---------+---------+ // | size | Some(a) | None | // | size | None | Some(b) | //…
arpad
  • 421
  • 4
  • 9
2
votes
1 answer

Multiple left joins using slick?

I have the following slick entities: class Person(personId, houseId, carId) class House(houseId) class Car(carId) I want to select a Person and their optional house and car, my query is: val query = personTable .filter(_.personId ===…
Rory
  • 798
  • 2
  • 12
  • 37
2
votes
1 answer

Conditionally running Slick statements in a for comprehension

Given the following Slick code: val doUpdate = true val table1 = TableQuery[Table1DB] val table2 = TableQuery[Table2DB] val table3 = TableQuery[Table3DB] val action = (for { _ <- table1.filter(_.id ===…
ps0604
  • 1,227
  • 23
  • 133
  • 330
2
votes
1 answer

Avoiding MySQL explicit declaration in Slick 3.x

In Slick 3.x, I use the code below to wrap the fact that the database is MySQL. This allows me to declare MySQLDriver just one time in the entire application: package util import slick.driver.MySQLDriver trait DbDriver extends MySQLDriver { val…
ps0604
  • 1,227
  • 23
  • 133
  • 330
2
votes
0 answers

Slick3.2 Error: No matching Shape found

I'm not sure what is wrong here. The following code block is throwing error: (for { (e,r) <- tblDetail.joinLeft(tblMaster).on((e,r) => r.col1 === e.col3) } yield (e.id) Error No matching Shape found. [error] Slick does not know how to…
Sujit Baniya
  • 895
  • 9
  • 27
2
votes
1 answer

How do I combine Playframework evolutions with Slick Tables autogeneration?

Playframework allows me to use evolution SQL scripts to keep my database up-to-date. (https://www.playframework.com/documentation/2.5.x/Evolutions) Slick allows me to run a generation program that reads my database structure and creates table and…
pijo
  • 31
  • 2
2
votes
2 answers

Assign dynamically injected database name in Play Slick

I have the following Play Slick DAO class. Note that the database configuration is a constant control0001. The DAO has a function readUser that reads a user based on its user id: class UsersDAO @Inject()(@NamedDatabase("control0001") protected…
ps0604
  • 1,227
  • 23
  • 133
  • 330
2
votes
1 answer

Slick 3.2: Filtering on columns from left-joined table

Given the following using Slick 3.2: val contacts = TableQuery[ContactTable] val phones = TableQuery[PhoneTable] val query = contacts.joinLeft(phones).on(_.contact_id === _.id) query.filter{ case (contact, maybePhone) => ... } maybePhone is a…
2
votes
1 answer

Comparing java.sql.Timestamp and LocalDate using slick?

I have a slick column that is a Rep[Option[Timestamp]]. I'd like to compare it to a user supplied java.util.LocalDate via the filter method. I'm only interested in comparing the date (ddMMyyyy), not the time: val userSuppliedLocalDate: LocalDate =…
Rory
  • 798
  • 2
  • 12
  • 37
2
votes
1 answer

Does the Oracle Slick Driver support Streaming?

I am using Slick 3.1.0 on Scala 2.11.8. This is using the slick extensions to query an Oracle database. I wrote the following code type MyTup = (String, String, String) implicit val actorSystem = ActorSystem() implicit val materializer =…
Knows Not Much
  • 30,395
  • 60
  • 197
  • 373
2
votes
1 answer

Update Scala Slick rows with optional columns

I have a Slick Table with multiple columns, and I want to update some of those columns based on user input. My table looks like this: class Users(_tableTag: Tag) extends Table[User](_tableTag, "users") { def * = (id, name, email, phone,…
Jacob Lyles
  • 9,920
  • 7
  • 32
  • 30
2
votes
1 answer

Slick: TableQuery[SomeType].result not found

I am having a problem similar to this But I am using scala 2.11.1, slick 3.2.0, and compiling manually with SBT, not using IntelliJ. I've defined an dntity for database: case class ScheduleItem(id:Option[Int], cron:String, script:String,…
André Claudino
  • 558
  • 4
  • 18
2
votes
1 answer

Filter query based on sum of LocalDate and Option[Int] in Slick

I have a DB table with two columns: startDate -> date type duration -> nullable integer In my Slick configuration these columns are defined as LocalDate (I'm using Joda) and Option[Int] respectively. Now, I want to write a query which given a date…
Alex Ntousias
  • 8,962
  • 8
  • 39
  • 47
2
votes
0 answers

Single database transaction in Slick 3.1 with plain SQL updates

I'm trying to run in Slick 3.1 a transaction that contains two updates. The second update is plain SQL using Slick's sqlu command. This is my attempt: val table = TableQuery[TableDB] val update1 = table.filter(f => f.name ===…
ps0604
  • 1,227
  • 23
  • 133
  • 330
2
votes
1 answer

Specifying sorting order for MappedColumnType based column in Slick

I have custom MappedColumnType for Java8 LocalDateTime, defined like this: implicit val localDTtoDate = MappedColumnType.base[LocalDateTime, Timestamp] ( l => Timestamp.valueOf(l), d => d.toLocalDateTime ) Columns of that type are used in…
akashihi
  • 917
  • 2
  • 9
  • 19