Questions tagged [doobie]

Doobie is a pure functional JDBC layer for Scala and Cats.

Doobie is a pure functional JDBC layer for Scala and Cats.

It is not an ORM, nor is it a relational algebra; it simply provides a principled way to construct programs (and higher-level libraries) that use JDBC.

http://tpolecat.github.io/doobie/

99 questions
1
vote
1 answer

Mapping a Many-to-Many Releationship Using Doobie

I have two tables in Postgres. The first contains generic information about movies, whereas the latter contains actors. CREATE TABLE "MOVIES" ( "ID" uuid NOT NULL, "TITLE" character varying NOT NULL, "YEAR" smallint NOT NULL, "DIRECTOR"…
riccardo.cardin
  • 7,971
  • 5
  • 57
  • 106
1
vote
1 answer

Cannot find or construct a Read instance for type: Option[A]

Why doobie can't convert query as Option[A]? abstract class CRUDAbs[A: Read](val tableName: String) extends TransactSQL { def table: Fragment = Fragment.const(s"$tableName") def columnsList: Array[String] = { val cls =…
1
vote
2 answers

Simba JDBC Driver and Read timed out error BigQuery

I'm using Simba JDBC driver for bigquery in a scheduled job. Many times the job works and sometimes it fails because of: sept. 08 12:40:38.307 TRACE 677 com.simba.googlebigquery.googlebigquery.client.BQClient.insertJob: Read timed…
1
vote
1 answer

Scala Doobie not inserting values into database

My code to insert values is: def insert(link: entity.Link) : IO[Int] = { logger.info("Inserting link: " + link.toString()) sql"insert into links (title,url,publication_date,feed_id) values…
Vitaly Olegovitch
  • 3,509
  • 6
  • 33
  • 49
1
vote
0 answers

akka message wrtite into a doobie as a sink to postgres

I Have an issue when i try to write into a postgres table from an akka actor when it receives the message data. I dont't know exactly the real probem i think that is the async context, because when i call a function with some list data as params the…
javier_orta
  • 457
  • 4
  • 15
1
vote
0 answers

Is it possible to push values to Kafka asynchronously using cats.effect.IO and FS2 Streams while returning an HTTP response immediately?

The problem that I'm trying to solve can be described as follows: A k8s scheduler calls each Monday morning an HTTP endpoint of my Finagle/Finch application The HTTP endpoint will handle the request and returns an IO[Int] (immediately) Before…
sentenza
  • 1,608
  • 3
  • 29
  • 51
1
vote
0 answers

Postgresql array encoding in Doobie – text[] vs varying[]

Suppose we have this postgresql schema: CREATE TABLE "temp" (id int, fields text[]); INSERT INTO "temp" VALUES (1, array['abc', 'def']), (2, array['abc', 'def', 'jkl']), (3, array['abd', 'def']), (4, '{"1{c}1", a}'); The following works in…
Nikita
  • 2,924
  • 1
  • 19
  • 25
1
vote
2 answers

Multiple queries in a single transaction with Doobie?

Let's say I have two case classes C1 and C2 that are each inherit from trait T. I have two Query0 objects parameterized by these case classes Query0[C1] and Query0[C2]. The goal is that when I execute those queries I want to obtain a single List[T]…
mdornfe1
  • 1,982
  • 1
  • 24
  • 42
1
vote
0 answers

ZIO [Declarative] Transactional Management

I spent a lot of time figuring out transactions on my otherwise well running ZIO+HTTP4S+Doobie-project. How can I have proper [declarative] transaction management? Something like Spring @Transactional. I read this very good post…
andersbohn
  • 109
  • 6
1
vote
1 answer

Proper usage of Monix 3.2.2 Observable with Doobie 0.9.0

I would like to use Monix Observable with Doobie (fs2) stream, but can't seem to get it working properly. Without streaming, my test app exits just fine but after using streaming, my TaskApp seems to hang on shutdown and can't figure out why. Here…
anttik
  • 19
  • 4
1
vote
1 answer

Could not find or construct Param[shapeless.::[String,shapeless.::[io.circe.Json,shapeless.HNil]]]

I am working on a basic job-board app for practice and when trying to compile my Scala code I am getting the following error. [warn] insecure HTTP request is deprecated 'http://repo.typesafe.com/typesafe/releases/'; switch to HTTPS or opt-in as…
Ry2254
  • 859
  • 1
  • 10
  • 19
1
vote
1 answer

Try to update postgresql database using Doobie but no update happening

I'm trying to update table in postgresql database passing dynamic value using doobie functional JDBC while executing sql statement getting below error.Any help will be appreciable. Code Working code sql"""UPDATE layout_lll |SET…
user9318576
  • 389
  • 1
  • 4
  • 13
1
vote
1 answer

How is this app converting from an IOConnection/IO to a future when integrating with Play?

I'm looking at this repo on github that is using both play and doobie. I want to understand how it is eventually converting from a connectionIO/IO from cats to a Future that the playframework is built around from. I'm looking at a controller and I…
Blankman
  • 259,732
  • 324
  • 769
  • 1,199
1
vote
1 answer

Doobie running multiple effects f1 and f2 in a transaction in the generic context F?

I would like to run two effects f1 and f2 updating two different database tables t1 and t2 while staying in the generic F context. def update(model:Details): Update0 = sql"""Update details_compta set TRANSID=${model.transid},…
Bate
  • 23
  • 8
1
vote
1 answer

Cannot construct a Read instance for type User. Type misunderstanding with Doobie in Scala

I am trying to return a User record from a database using doobie, http4s, and cats. I have been stymied by the type system, which is providing the following error based on the code below: router: val httpRoutes = HttpRoutes.of[IO] { case GET ->…
gutscdav000
  • 359
  • 1
  • 3
  • 14