Skip to main content

Questions tagged [doobie]

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

4 votes
1 answer
373 views

How to connect to Hive using doobie

There is a jdbc driver for hive but seems not fully functioning. I used the default doobie Transactor to connect to it like val xa = Transactor.fromDriverManager[IO]( "org.apache.hive.jdbc....
KailuoWang's user avatar
  • 1,314
0 votes
1 answer
720 views

How do I create a Doobie Meta instance for MySQL using Play JSON?

How do I implement basic serialization/deserialization at the query level using Doobie, MySQL, and Play JSON?
JPotts's user avatar
  • 302
9 votes
1 answer
2k views

Doobie transact over a list of ConnectionIO programs

Let's say I have a list of Doobie programs (all with Unit type parameters, fwiw): val progList: List[ConnectionIO[Unit]] = prog1 :: prog2 :: ... :: Nil Is there any way I can run them in one ...
Lasf's user avatar
  • 2,562
0 votes
2 answers
172 views

List to multiple anonymous/underscore parameters in for-comprehension

I'm kind of new to Scala/functional so I'm not yet able to use technical language. I'm experiencing problems with a for-comprehension val queries = for { _ <- createBanco _ <- ...
Alejandro's user avatar
14 votes
1 answer
1k views

Running queries in parallel in Doobie

Is it possible to run multiple queries in parallel, using Doobie? I have the following (pseudo)queries: def prepareForQuery(input: String): ConnectionIO[Unit] = ??? val gettAllResults: ...
mdm's user avatar
  • 3,978
0 votes
1 answer
688 views

Scala Doobie query hardcoded values

When writing the following query in Doobie : (SELECT id FROM (VALUES(?),(?),(?)) table(id)) UNION SELECT id FROM table I have list of data , e.g. List(1,2,3,4) that is varied-size. How could I ...
WeiChing 林煒清's user avatar
17 votes
1 answer
5k views

Doobie and DB access composition within 1 transaction

Doobie book says that it's a good practice to return ConnectionIO from your repository layer. It gives an ability to chain calls and perform them in one transaction. Nice and clear. Now let's ...
Eugene Zhulkov's user avatar
0 votes
2 answers
1k views

Create list of case class instances

I have 3 vals, each of type Array[String] they are all equal in length val1.length == val2.length // true Next, I created a case class as following: case class resource(name: String, count: Int, ...
rangeelo's user avatar
  • 118
5 votes
2 answers
2k views

Compose optional queries for for-comprehension in doobie?

I would like to run several queries in one transaction using a for-comprehension in doobie. Something like: def addImage(path:String) : ConnectionIO[Image] = { sql"INSERT INTO images(path) VALUES($...
janne's user avatar
  • 131
4 votes
1 answer
3k views

Doobie with Hikari setup

I want to get the hikari transactor setup to act just like the standard transactor val xa = HikariTransactor.newHikariTransactor[IO]( "com.mysql.jdbc.Driver", JdbcUrl, Username, ...
Matthew Fontana's user avatar
0 votes
1 answer
1k views

Transforming Doobie ConnectionIO[Option[Int]] without explicit match

I have a ConnectionIO[Option[Int]] and map over the Option to produce a ConnectionIO[Option[String]] with a query the Some[Int] otherwise keep the Nones. I was able to do this with aforcomprehension ...
Arne Claassen's user avatar
13 votes
3 answers
2k views

Scala doobie fragment with generic type parameter

I am trying to abstract inserting objects of different types into sql tables of similar structure. Here's what I'm trying to do: class TableAccess[A : Meta](table: String) { def insert(key: String, ...
Joe K's user avatar
  • 18.4k
3 votes
2 answers
3k views

How to correctly handle Hikari connection pool with Doobie

I've been using doobie (cats) to connect to a postgresql database from a scalatra application. Recently I noticed that the app was creating a new connection pool for every transaction. I eventually ...
user1830452's user avatar
0 votes
1 answer
283 views

Scala (doobie): Type is invariant

I'm working on a project with Scala and doobie. I'm trying to implement a transactor trait that may be injected by MacWire and used with different Task/Future monads (e.g. for tests). import doobie....
Raphael Mäder's user avatar
2 votes
0 answers
623 views

Doobie streaming query causes invalid operation

Doobie Without much experience in either Scala or Doobie I am trying to select data from a DB2 database. Following query works fine and prints as expected 5 employees. import doobie.imports._, ...
conspicillatus's user avatar

15 30 50 per page
1
3 4 5 6
7