Questions tagged [doobie]
Doobie is a pure functional JDBC layer for Scala and Cats.
doobie
105
questions
1
vote
0
answers
423
views
org.postgresql.util.PSQLException: The column index is out of range
The exception
org.postgresql.util.PSQLException: The column index is out of range: 2, number of columns: 1.
... only occurs if a string interpolation is added to the query below, for example:
[...](...
2
votes
2
answers
2k
views
Save Doobie stream from database to file
Doobie select returns an fs2.Stream(doobie.ConnectionIO, String). If we need to write it to file the obvious option is to call stream.compile.toList.transact(transactor) and then save this list to ...
1
vote
1
answer
401
views
Doobie example complains about column index mismatch
Trying out the stock Doobie example, and getting an exception complaining about an "Invalid column index". My query is extremely simple: it selects two columns from one Oracle table, and I expect ...
2
votes
1
answer
649
views
Scala Doobie does not return anything when using OR WHERE
I am trying to select from database with several filters. Code:
// name is List("Denis", "Semen")
val query = name.map(_ + "%").mkString(" OR name LIKE ")
sql"SELECT * FROM phonebook WHERE name ...
1
vote
1
answer
674
views
Issues when using Doobie library with Oracle and Timestamp
I am trying to use Doobie with oracle and I am getting some type issues:
I have a table:
create table TEST
(
CREATED_ON TIMESTAMP(6) not null,
A VARCHAR2(50) not null,
B ...
3
votes
1
answer
928
views
How to generate SQL statements dynamically using Doobie (scala)
I have the query:
val sql = """select
id,
clientName
from
partnerClients
where
partnerName = ?
...
2
votes
4
answers
866
views
Scala Doobie PSQLException: ERROR: syntax error at end of input when use "Like %"
I am using PostgreSQL 12.1 with Scala and Doobie. Getting exception when trying to do query with LIKE % syntax. It works without %.
My code:
implicit val cs = IO.contextShift(ExecutionContexts....
3
votes
0
answers
553
views
Doobie. Set connection timeout
How to set connection timeout using Doobie?
For now, I am creating a new hikari transactor, and then configuring it:
def buildTransactor(driver: String, uri: String,
user: ...
6
votes
4
answers
4k
views
Doobie - lifting arbitrary effect into ConnectionIO
I'm trying to send an email in the same transaction as inserting user into a database with Doobie.
I know that I can lift IO into ConnectionIO by using Async[ConnectionIO].liftIO(catsIO) where catsIO: ...
3
votes
0
answers
238
views
Getting Error while querying to mysql with doobie
I have transactor below
val transactor: Resource[IO, HikariTransactor[IO]] =
for {
ce <- ExecutionContexts.fixedThreadPool[IO](32) // our connect EC
be <- Blocker[IO] // our ...
4
votes
1
answer
545
views
provide Get instance for Seq
For instance, I have some entities with some params, and two database tables, representating this entities:
entity param
╔════╦═════════╗ ╔═══════════╦════════╗
║ id ║ name ║...
2
votes
2
answers
1k
views
How to configure transactor in doobie?
Recently I started learning doobie but I couldn't create a hikari transactor without error. I'm using mysql, Intellij-Idea.
This is my build.sbt file
name := "doobie"
version := "0.1"
//scalaVersion ...
12
votes
1
answer
5k
views
Doobie cannot find or construct a Read instance for type T
I'm using doobie to query some data and everything works fine, like this:
case class Usuario(var documento: String, var nombre: String, var contrasena: String)
def getUsuario(doc: String) =
...
4
votes
1
answer
228
views
How to pass complete query as a parameter
I get a query from gitlab ci and I want to execute it.
If I hardcode the query is the sql"""""" syntax it works. But I want to pass it as a variable(the whole query). the SqlInterperator doesn't ...
0
votes
1
answer
712
views
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 ...