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
4
votes
1 answer

Play 2.4 tests with Slick, specs2 and Postgresql

What I want is to run my tests with the same databse engine, same evolutions and config as in production. My db is PostgreSQL 9.4 and I use Slick 3.0.0 to access it. And here the problems: In case of parallel tests execution I have several…
sedovav
  • 1,986
  • 1
  • 17
  • 28
4
votes
1 answer

Database Exception in Slick 3.0 while batch insert

While inserting thousands of records per five seconds through batch insert in slick 3 I am getting org.postgresql.util.PSQLException: FATAL: sorry, too many clients already My data access layer looks like : val db:…
Archana
  • 405
  • 4
  • 16
4
votes
1 answer

Slick table does not take type parameter

I'm playing around with slick 3.0.0's new DBIO api but am having some problem with generics. With this code: import scala.concurrent._ import slick.driver.MySQLDriver.api._ import slick.lifted.AbstractTable object Crud { def fetchById[T:…
Ferdy
  • 497
  • 2
  • 4
  • 13
3
votes
0 answers

Slick DBIO.sequence throws No implicits found for parameter cbf: compat.Factory

I have the following model: case class Bar(id: Int, code: Option[String]) class BarTable(tag: Tag) extends Table[Bar](tag, "bar") { def id = column[Int]("id", O.PrimaryKey, O.AutoInc) def code = column[Option[String]]("code") def * =…
wiradikusuma
  • 1,930
  • 4
  • 28
  • 44
3
votes
1 answer

Scala - Slick - Getting a TypedType for a wrapped Option[T]

It is usual to create custom IDs like this: case class CustomID(value: Int) extends MappedTo[Int] and to represent nullable custom IDs with types like Option[CustomID]. However, I would like to be able to move Option[_] into the case class, like…
l00kah3ad
  • 33
  • 2
3
votes
0 answers

Slick Queries With GroupBy

I'm new to Scala and Slick. I'm trying to run a query with a grouping by an object and creating two sequences for each object. This is my code : val firstQuery = { for { table1Id <- Table1.filter(_.someid === someid).map(_.someid) …
3
votes
0 answers

How to audit database changes using slick

I am using slick 3.2 as the DB access library in a project. One of the requirements is to track all data changes. I am looking for something similar as Hibernate Envers module. I was looking at Active Slick, any experiences with it? If possible I…
Tadej Mali
  • 1,143
  • 8
  • 18
3
votes
3 answers

Connecting Slick 3.2.1 to MySQL using slick.jdbc.MySQLProfile

There are 100s of threads on SO on how to connect slick to Mysql and all of them use "slick.driver.MySQLDriver$". I believe that this class is now deprecated and has been replaced by "slick.jdbc.MySQLProfile" This has been stated by the product…
Knows Not Much
  • 30,395
  • 60
  • 197
  • 373
3
votes
1 answer

Slick 3.1, Left Joins and Filters

I have a Slick query with two left joins (which end up as a Rep[Option[...]]) and column maps. I need to filter (using like) on the results. A row has to be included in the results if any of three columns match the like criteria, so I can't…
Michael Bar-Sinai
  • 2,729
  • 20
  • 27
3
votes
2 answers

Deleting Rows from multiple tables in a slick query

I googled and found this thread Slick 3.0: Delete rows from multiple tables in a transaction However the solution says that its not a good solution. I am deleting rows from multiple tables with my code below val deleteB = for { aId <-…
Knows Not Much
  • 30,395
  • 60
  • 197
  • 373
3
votes
1 answer

slick maintain updated_at and inserted_at field

Most of my database table models have inserted_at and updated_at timestamp fields which must be updated on creation and update events respectively. Is it possible to do this in a most DRY and transparent way in Slick. These audit columns are also…
rogue-one
  • 11,259
  • 7
  • 53
  • 75
3
votes
1 answer

Update top n rows of a table in slick

I want to update top n rows of a table not the entire one when using slick 3.0 This is the update all version: private[this] val active = this.filter(a => a.status =!= AccountStatus.DISABLED) db.run( active.filter(a => a.usedBy.isEmpty ||…
Quy Tang
  • 3,929
  • 1
  • 31
  • 45
3
votes
1 answer

Configuring two databases in PlaySlick using injection

I'm trying to configure two databases using PlaySlick as documented here. The problem in the code below is that even though I configured a second database db2 any attempt to use it redirects the action to db1 (tries to find the table in db1 and…
ps0604
  • 1,227
  • 23
  • 133
  • 330
3
votes
2 answers

Catching SQL error on future failure in Slick

The code below uses Slick 3.1.x to read a row from a table, attempting to catch any SQL errors. UserDB is the Slick representation of the table, and User is the related object. This code does not compile in the failure statement with the following…
ps0604
  • 1,227
  • 23
  • 133
  • 330
3
votes
2 answers

Slick 3 truncate tables for testing

I need to use my old code with Slick 3 but it is not working and I don't know how to do it. my old code : database.withSession { implicit s: Session => StaticQuery.updateNA("SET foreign_key_checks = 0").execute() val q =…
earlymorningtea
  • 508
  • 1
  • 9
  • 20