Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    etandon-coatue
    @etandon-coatue

    Seeing some stage behavior. We are setting a statement timeout on postgres at code level to 1 min (global setting for DB is 15 mins):

    db.withDynSession {
            sqlu"SET STATEMENT_TIMEOUT = 60000".logAndExecute())
            query.list
          }.map(_.toMap(keys))

    However we are seeing some other flow inherit this timeout value.
    My assumption is that the STATEMENT_TIMEOUT value will reset after this execution. Is that not true?
    Slick version: 2.1.0
    Should we explicitly reset the statement timeout in this case?

    nafg
    @nafg
    Wow that's an old version
    Dheeraj Karande 🇮🇳
    @dheerajkarande_twitter
    Hi all, anyone using slick with Oracle?
    Alessandro Buggin
    @abuggin
    Hello, I'm getting could not find implicit value for parameter e: slick.jdbc.SetParameter[TRAIT]
    any hint of what should I provide?
    nafg
    @nafg
    You have to make your own implicit SetParameter[TRAIT]
    It's probably documented on the site
    Peter Robinson
    @pmpfr
    Hello. I've been seeing my slick app sometimes permanently timing out all postgress calls until a restart. I believe it's because all the connections in the Hikari pool end up leaked. I set leakDetectionThreshold to 40 seconds and I also upgraded slick from 3.2.1 to 3.2.3. Since then (a few days) I see some suspected leaks logged, but only a handful and no total lockups. I have a couple of questions:
    Re leakDetectionThreshold, when it fires, does it just log or does it reclaim the slot in the pool as well?
    Peter Robinson
    @pmpfr
    I've read scary comments about the perils of setting the hikari connection pool size without telling slick about it, and that here's a particular combination of hickari pool size vs slick thread pool size which causes problems. Could that explain it? What is the exact rule? I am calling HikariCPJdbcDataSource.forConfig(config, ...) where config comes via ConfigFactory.empty()....withParameter("maxConnections", 20).withParameter("minConnections", 20)
    rmmuthu
    @rmmuthu
    Yes Slick works with Oracle with the DatabaseConfig.forConfig. I have trouble however getting to work with proxy user. While doing it in code, we will do conn.unwrap(classOf[OracleConnection]).openProxyConnection. I am not sure if there is a way to tell slick this either through forConfig or pass java.sql.Connection and create Slick JDBCProfile.
    JLofgren
    @JLofgren
    Hello, all. I am trying to work out how Hikari options fit in the typesafe config for slick. https://github.com/brettwooldridge/HikariCP#configuration-knobs-baby How do I configure Hikari? Specifically, I'm wondering about how to set autoCommit = false. Is this the right idea?
    slick {
      profile = "slick.jdbc.SQLServerProfile$"
      db {
        poolName = "mypool"
        readOnly = false
        autoCommit = false
        connectionTimeout = 10000
        ...
    Also, I can't find much mention at all about autoCommit in the Slick 3 documention. Will this setting actually change anything?
    Richard Dallaway
    @d6y
    The Slick homepage points users towards a product called Activator to get started (https://scala-slick.org/ - see the "NEW TO SLICK? on the right, and the video introduction). Given that activator is dead...
    ... what should we replace them with? Any thoughts?
    Luis Martinez
    @luis3m

    Hello,

    Is it possible to batch update with slick?

    Richard Dallaway
    @d6y
    Hi @luis3m - in the most general case, plain sql lets you do a batch update.
    Luis Martinez
    @luis3m
    @d6y hi, you mean something like update Table set Table.column = values.value from (values(?, ?)) values where condition?
    Richard Dallaway
    @d6y
    Well. I don't mean any particular kind of update SQL. The regular Slick update (table.filter(whetever).map(columns).update(values)) will update multiple rows (depending on the filter), but the update values are fixed and the same for all rows updated. Plain SQL lets you do anything you can in SQL: sqlu"update table set column = column +1" for example.
    Maybe I don't know what we mean by batch update :-)
    Luis Martinez
    @luis3m
    So per each row I want to set a different value for a particular column
    Richard Dallaway
    @d6y
    Ok - then Plain SQL is what wouldn't probably best fit.
    Luis Martinez
    @luis3m
    Something like this is what I'm looking for: update Products p set p.inventory = temp.inventory from (values(1 as id, 5 as inventory) ...) temp where p.id = temp.id
    Richard Dallaway
    @d6y
    Take a look at https://scala-slick.org/doc/3.3.3/sql.html for how to execute that
    It's sqlu you'll need.
    Luis Martinez
    @luis3m
    Thanks
    q10
    @q10
    Hello, is there a Slick way to do conditional upsert? I would like to upsert, but only if a certain condition holds true: insert into "table" (...) values (?...) on conflict (primary_keys) do update set ... where .... Slick's insertOrUpdate is able to do everything except adding that condition.
    Pascal Danek
    @pascaldanek
    Hello, i am curious about scala 3 support. Does someone know what we should expect ?
    nafg
    @nafg
    In @djspiewak's talk he said it was already ported. I know @szeiger was working on it a long time ago but I didn't know he finished it. In anyone knows more info I'm interested too
    Daniel Spiewak
    @djspiewak
    if I misspoke I apologize; I was under the impression it was fully ported
    nafg
    @nafg
    @djspiewak I have no idea, I was wondering where you got your info from
    Maybe it is fully ported in that fork+branch, do you know if it's published?
    Daniel Spiewak
    @djspiewak
    rewinding back several months and evesdropping on @szeiger in the dotty channel
    I don't know, but I'd assume it hasn't been published
    nafg
    @nafg
    I remember him saying he was working on it
    Daniel Spiewak
    @djspiewak
    I remember him having success at one point in getting the major stuff reencoded in terms of Dotty's metaprogramming
    nafg
    @nafg
    cool
    great talk btw
    Daniel Spiewak
    @djspiewak
    ty!
    Antoine Doeraene
    @sherpal
    I also remember seeing a tweet from @szeiger saying that he successfully ported Slick to Scala 3. It was several months ago already.
    Pascal Danek
    @pascaldanek
    Thanks guys, i guess at some point we will have some sort of official statement
    AIIIN
    @AIIIN

    Hey Guys,
    I am new to Scala and slick. I am using it within the play framework. I have a question on the following query:

        val query = table.filter(tab => (tab.id === id && tab.otherId === otherId)).map(column => (column.desiredCell))
        val dataBaseIOAction = query.result
        val desiredCell: Future[String] = db.run(dataBaseIOAction) // db.run(dataBaseIOAction) is of type Future[Seq[Option[String]]]

    The last line of code has a type mismatch. Scala tells me that it will result in a Future[Seq[Option]]], however I know that there will be only one column that will satisfy the filterand map should return the value from the column I want and since it is one one column I should get the cell value.
    I am clearly missing something, could anyone help?

    Thanks in advance!

    nafg
    @nafg
    @AIIIN query.result.head
    AIIIN
    @AIIIN
    @nafg I see. If I use query.result.head Scala knows, that it is not a Seq, right?
    Roger Rojas
    @roger-rojas
    Hey, new to Scala and Slick too. I'm having an issue where data that is too long to fit into a MySQL TEXT column is throwing an exception. Rather than throw an exception I would like to truncate it (with some additional processing). My question: Is there a way of discovering the max size of the column in Slick? I know MySQL's default TEXT field size is 65535, but I would like to be able to discover that when the app starts up instead of hardcoding the value, hopefully keeping the truncation + processing step independent of the db.
    nafg
    @nafg
    @AIIIN yes, look at its return type
    1 reply
    Richard Dallaway
    @d6y
    @roger-rojas I think there are API calls to find information about columns (it's in the JDBC API that Slick uses). Take a look at https://stackoverflow.com/questions/35413956/trying-to-get-the-column-size-of-a-column-using-jdbc-metadata for an example of that. To access the JDBC API from Slick, there's https://scala-slick.org/doc/3.3.3/dbio.html#jdbc-interoperability
    1 reply
    AIIIN
    @AIIIN

    I have another question. It seems that I have problems to retrieve an optional value called bID inside a join statement:

    val bQuery = tableQuery.map(column => (column.bID, column.info))
    aQuery = aQuery joinLeft bQuery on (_._1._1.aID === _._1.bID)

    I also tried _.bID and _._1.map(_.bID).
    bID is of type Rep[Option[Long]].
    I would be very greatful for any help.

    Richard Dallaway
    @d6y
    @AIIIN what might work for you is _1.aID.? --- as the ? method takes your aID into an Option, the same as bID. In SQL, it'll give you = semantics on the two columns.