Skip to main content

All Questions

Tagged with
0 votes
0 answers
90 views

Ambiguous Implicit Resolution Error With Doobie

I have this function that inserts a One To Many relationship representation between 3 tables: def insertRelations(cs: TableA): Fragment = { sql"""INSERT INTO my_schema.table_a ( ...
joesan's user avatar
  • 14.9k
0 votes
1 answer
120 views

Scala Cats Effect Wrapping an Implementation from the Effect Type of the Enclosing Class

I have an implementation that looks like this: final class MyServiceImpl[M[_]: Async](dbCfg: DBConfig)(implicit ec: Scheduler) extends MyService[M] { ...... ...... ...... ...... } Inside this ...
joesan's user avatar
  • 14.9k
0 votes
1 answer
96 views

Doobie upgrade from 1.0.0-RC2 to 1.0.0-RC4 causes fragments.or not to compile

My code (below) is failing to compile after a Doobie library upgrade. fragments.or(filterFragments: _*) "Cannot resolve overloaded method 'or'". Presumably the signature has changed but I ...
Tom Squires's user avatar
  • 9,146
0 votes
1 answer
347 views

Doobie cannot find or construct a Read instance for Type of case class with Timestamp

Given a case class representation of a data row with a java.sql.Timestamp: case class ExampleRow(id: String, ts: Timestamp) And query expecting an ExampleRow: import doobie._ import doobie....
Ramón J Romero y Vigil's user avatar
0 votes
0 answers
67 views

Refactoring my for comprehension to remove the unsafe get calls on the option values

So my for comprehension technically compiles fine currently, but if you look carefully I have a few unsafe .get calls on the options. for { maybeProduct: Option[Product] <- EitherT.liftF { ...
Blankman's user avatar
  • 265k
1 vote
0 answers
374 views

Create clickhouse temporary table with doobie

I want to create clickhouse temporary table with doobie, but i don't know how to add session_id parameter in query I tried val sql = sql"CREATE TEMPORARY TABLE " ++ Fragment.const(...
Andrew 's user avatar
0 votes
0 answers
66 views

How to refactor so I can return different types in my case statement and then execute the doobie queries

Based on the match condition I will need to execute a different doobie query, and these queries may return different Right types in their Eithers. The problem currently is that sometimes the Right of ...
Blankman's user avatar
  • 265k
1 vote
1 answer
53 views

Refactor function to remove unsafe .get calls when making doobie database queries

My DAO method types are: ProductDao.getById(..): ConnectionIO[Option[Product]] InventoryDao.getById(..): ConnectionIO[Option[Inventory]] The function I need to refactor to make it safe is below: def ...
Blankman's user avatar
  • 265k
0 votes
1 answer
153 views

For comprehension that has to handle 2 optional values and return a Option[T]

The below code works fine, but as you can see the 2nd clause in the for comprehension has a call that is unsafe. case class ProductView(product: Product, stores: List[Store], warehosue: Option[...
Blankman's user avatar
  • 265k
2 votes
2 answers
452 views

Scala Doobie. Creating and Inserting into a Temp Table

I am relatively new to Scala and also new to Doobie. I am connecting to SQL Server 2014 and need to create a temp table and subsequently insert into that temp table. In SQL Server, when you create a ...
mljohns89's user avatar
  • 907
0 votes
1 answer
191 views

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 ...
IllSc's user avatar
  • 1,449
1 vote
1 answer
885 views

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&...
riccardo.cardin's user avatar
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,...
Vitaly Olegovitch's user avatar
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[...
ClassNotFoundException's user avatar
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 ...
sentenza's user avatar
  • 1,730

15 30 50 per page