Questions tagged [doobie]
Doobie is a pure functional JDBC layer for Scala and Cats.
doobie
105
questions
1
vote
2
answers
3k
views
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....
3
votes
2
answers
2k
views
How I can insert case object as JSONB format via Doobie?
I use scala 2.13 and doobie 0.12.1
For example,
I have case class
case class UserInfo(name: String, age: Int, hobbies: Vector[String])
I want insert user info in column info as jsonb
sql""&...
0
votes
1
answer
551
views
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, &...
1
vote
1
answer
309
views
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(...
1
vote
1
answer
341
views
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,...
1
vote
0
answers
154
views
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 ...
7
votes
1
answer
3k
views
Is it okay to use "unsafeRunSync()" in Cats-Effects?
I am using Doobie and in the examples that I found, it uses unsafeRunSync, like:
sql"select name from country"
.query[String] // Query0[String]
.to[List] // ConnectionIO[List[...
0
votes
1
answer
737
views
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) ...
0
votes
1
answer
664
views
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, ...
1
vote
0
answers
290
views
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 ...
1
vote
0
answers
706
views
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, ...
2
votes
2
answers
2k
views
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 ...
2
votes
1
answer
1k
views
Transactions in Doobie for Scala / Play Framework
I have a question regarding transactions in doobie.
I have looked over the documentation here and it looks like it can only handle one query at a time?
Is it possible to have something like this
sql'''...
9
votes
1
answer
2k
views
Experiencing deadlocks when using the Hikari transactor for Doobie with ZIO
I'm using Doobie in a ZIO application, and sometimes I get deadlocks (total freeze of the application). That can happen if I run my app on only one core, or if I reach the number of maximum parallel ...
4
votes
1
answer
3k
views
How do I convert a java.util.UUID to doobie.syntax.SqlInterpolator.SingleFragment?
I am trying to set up a simple scala app with database using doobie, http4s and circe.
How do I convert a java.util.UUID to doobie.syntax.SqlInterpolator.SingleFragment ?
final case class User(id: ...