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

Slick 3.0 with default connection pooling and postgresql 9.4.4 is throughing "too many clients already" error

Currently I am building an application with micro services. I have three instances which are actually interacting with the database i.e. Postgresql 9.4.4. Below is my connection properties with slick 3.0 dev { # Development Database configuration #…
Pranjut
  • 1,747
  • 5
  • 18
  • 31
3
votes
1 answer

Slick 3 insert not inserting but no error

I'm trying to get a hang of Slick by doing a small test. I'm trying to do an insert. The test runs, no errors, but when I check the db, no record has been inserted. What am I doing wrong? Here's my test code: Note: I disabled the first 'flatMap'…
Joost den Boer
  • 4,556
  • 4
  • 25
  • 39
3
votes
1 answer

How can compare column[option[DateTime] with DateTime.now on a filter of slick 3.0

i have the next problem.. im using spray.http.DateTime, and my mapper is: implicit val JavaUtilDateTimeMapper = MappedColumnType.base[DateTime, Timestamp] ( d => new Timestamp(d.clicks), d => spray.http.DateTime(d.getTime)) …
3
votes
1 answer

Slick 3.0 Logging Query Performance

Currently I have enabled DEBUG logging on: slick.backend It logs the transaction start/end, compiled sql query being run by slick, and success/results. Can slick provide me information about query running time? Which package should I enable DEBUG…
panther
  • 767
  • 5
  • 21
3
votes
2 answers

In Slick 3.0, how to simplify nested `db.run`?

I'm using Slick 3.0, and following is my codes: def registerMember(newMember: TeamMember): Future[Long] = { db.run( teamProfileTable.filter(u => u.ID === newMember.ID).result.headOption ).flatMap { case None => Future(-1) case _ =>…
user4622265
3
votes
1 answer

in Slick 3.0, how to I get from a query to a case class?

I am trying to use Slick for database in a Scala application, and running into some issues (or my misunderstandings) of how to query (find) and convert the result to a case class. I am not mapping the case class, but the actual values, with the…
Ehud Kaldor
  • 753
  • 1
  • 7
  • 20
3
votes
1 answer

Using database functions in Slick table definitions - how?

Did anyone succeed in using Slick (I am currently using 3.0.0-RC3, the latest available version) to generate a table definition containing DB-specific functions? If so, how to achieve that? Example: I have a column in Postgres with the following…
Ashalynd
  • 12,363
  • 2
  • 34
  • 37
3
votes
1 answer

How to add methods to Slick tables?

I'd like do perform something like that using Slick (I have updated to 3.0.0-M1): class MyTable extends Table[(Int, Int)](tag, "MyTable) { def a = column[Int]("a") def b = column[Int]("b") def * = (a, b) def total: Int = a + b //…
scand1sk
  • 1,114
  • 11
  • 25
2
votes
1 answer

How to perform JDBC authentication with Scala's Slick library?

Intro I have a microservice written in Akka HTTP which communicates with the frontend via an REST API. I use Scala's Slick library to communicate with the PostgreSQL DBMS. I want secure the API with HTTP's basic authentication mechanism (the…
Dawid
  • 477
  • 3
  • 14
2
votes
1 answer

How to create generic method to update multiple columns in Slick?

I have this generic method to update one column def updateColumn[V](id: Int, column: Table[UserRow] => Rep[V], value: V)(implicit shape: Shape[_ <: FlatShapeLevel, Rep[V], V, _]) = userTableQuery.filter(user => user.id ===…
ais
  • 2,514
  • 2
  • 17
  • 24
2
votes
1 answer

Using Scala Slick with database enums

Using Slick 3 and PostgreSQL, I need to query and update a table that has an column of type enum: create type WeekDay as ENUM('sun','mon','tue','wed','thu','fri','sat'); create table shifts( id serial PRIMARY KEY, user_id INTEGER, …
Michael Bar-Sinai
  • 2,729
  • 20
  • 27
2
votes
1 answer

Why grouping method sum in slick returns Option even if column used for sum is mandatory column?

CREATE TABLE orders ( id bigint NOT NULL, ... created_on date NOT NULL, quantity int NOT NULL, ... CONSTRAINT orders_pkey PRIMARY KEY (id) ) SELECT DATE(o.created_on) AS date, sum(quantity) FROM orders o GROUP BY…
2
votes
0 answers

Slick/slick-pg - OffsetDateTime inserted as VARCHAR and String

I have the following model: final case class Wallet( ... pointExpiry: Option[OffsetDateTime], spinExpiry: OffsetDateTime, ... …
wiradikusuma
  • 1,930
  • 4
  • 28
  • 44
2
votes
1 answer

Future returned by Slick run method completes successfully before rows have been inserted

I am working a Scala app using Slick and PostgreSQL for storage. I have a method foo which reads data from a CSV file and inserts about 10,000 rows into the database. After the Future of the row insertion action completes, another method bar is…
Slick Vick
  • 55
  • 6
2
votes
1 answer

Slick Json Column Support with MySql

I have a Json type column in MySql and I am using Scala with Slick. How can I Provide support for the Json Column via Slick. class SampleTable(tag: Tag) extends Table[(String, ??)](tag, "test") { override def * : ProvenShape[NodeReference] =…
Akash Sethi
  • 2,284
  • 1
  • 20
  • 40