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

Testing Doobie Interpreter Using Testcontainers

I'm trying to test some SQL statements developed with doobie using Testcontainers libraries. In detail, I'm using the following dependencies: "org.testcontainers" % "testcontainers" % "1.17.3" % Test, "org.testcontainers" % "postgresql" %…
riccardo.cardin
  • 7,971
  • 5
  • 57
  • 106
0
votes
1 answer

Conditional Doobie query with Option field

I have following case class Request(name:Option[String], age: Option[Int], address: Option[List[String]]) And I want to construct a query like this the conditions should apply if and only if the field is defined: val req = Request(Some("abc"),…
Raman Mishra
  • 2,635
  • 2
  • 15
  • 32
0
votes
1 answer

Parallelizing operations within a ConnectionIO transaction

So I have a program in which I get a list of file paths from a database, delete those files on the filesystem and finally delete the file paths from the database. I put all operations inside a transaction to ensure that the paths would be deleted…
IllSc
  • 1,419
  • 3
  • 17
  • 24
0
votes
1 answer

Use UUID in Doobie SQL update

I have the following simple (cut down for brevity) Postgres table: create table users( id uuid NOT NULL, year_of_birth smallint NOT NULL ); Within a test I have seeded data. When I run the following SQL update to correct a…
D Ainslie
  • 33
  • 1
  • 6
0
votes
1 answer

Syntax error at or near "order" (Scala with Quill, Doobie and PostgreSQL)

I am using Quill with Doobie and PostgreSQL (org.tpolecat.doobie-quill artifact with version 0.13.1). This code case class SomeRecord(id: Int, order: Int, name: String) val record = SomeRecord(0, 0, "test") run( quote( …
DenisNovac
  • 621
  • 2
  • 8
  • 15
0
votes
1 answer

How to insert a linked object using Doobie

I need to insert into the database an object of the type Entity case class Entity(id: Long, name: String) case class OtherEntity(id: Long, entity_id: Long, info: String) case class AnotherEntity(other_entity_id: Long, data: String) How can I do…
grednoud
  • 9
  • 3
0
votes
1 answer

Doobie Query for Entities with Value Class Fields

I am using Doobie to manage database persistence. I use value class fields in my entity Foo i.e. case class CreatedOn(value: LocalDateTime) extends AnyVal case class Resource(value: String) extends AnyVal case class Foo(id: Option[Int],…
thlim
  • 2,908
  • 3
  • 34
  • 57
0
votes
1 answer

How to publish an FS2 Stream generated by Doobie to Kafka

I want to publish a long list of events into Kafka consuming an fs2.Stream that corresponds to a very big list of DB rows that will eventually cause an Out Of Memotry error if compiled to List. So, let's say that I have a - very big - list of UUID…
sentenza
  • 1,608
  • 3
  • 29
  • 51
0
votes
0 answers

Type parameterization for doobie select

I am trying to create a method that will accept a case class and return elements as a List[C]. To test things, I have the following which works object LocalRun extends App { implicit private val cs =…
0
votes
1 answer

How to read JSON out of Doobie Scala PostgreSQL Database with Circe?

I've tried creating the below implicit so that I can GET/read data from the postgreSQL database. I've tried add in the recommended implicits but they turn grey and seem to be unused. implicit val get: Get[JobPostDetails] = …
Ry2254
  • 859
  • 1
  • 10
  • 19
0
votes
1 answer

Cannot Connect to Docker postgres container - Scala

I have created a service called job-board I want it to run and talk to postgres container. I am not sure if I should run the job-board using sbt? or should I use docker-compose up to run both services with Docker? When do you run with SBT and when…
Ry2254
  • 859
  • 1
  • 10
  • 19
0
votes
1 answer

Scala Doobie & Hikari CP transactor handling

If you do this, HikariCP is init and shut down each time. Is there any way to avoid this and execute various queries? // Resource yielding a transactor configured with a bounded connect EC and an unbounded // transaction EC. Everything will be…
aposto
  • 566
  • 5
  • 14
0
votes
1 answer

Doobie and AWS Xray Tracing

I am trying to set up XRAY tracing for postgres DB . I keep getting Segment Not found error I following the instructions in this link https://docs.aws.amazon.com/xray/latest/devguide/scorekeep-workerthreads.html def save(event: EventRow): IO[Int] =…
Balaji V
  • 918
  • 3
  • 10
  • 28
0
votes
1 answer

jdbc - HikariCP: Seeing low insert thoughput while DB/App cpu % is still low

I've set up doobie + hikaricp with settings similar to the default. With debug logging I can see how many connections are active / idle and this also reflects what pg_stat_activity returns with this query SELECT pid, query, query_start, …
irregular
  • 1,437
  • 3
  • 20
  • 39
0
votes
0 answers

Reading using doobie

I have defined repository: trait Repo[F[_]] { def findAll: Stream[F, Stop] } and it's implementation: class DoobieRepo[F[_]: Sync](xa: Transactor[F]) extends Repo[F] { override def findAll: Stream[F, Stop] = …
oybek
  • 630
  • 4
  • 14