Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Lalli Nuorteva
    @lalnuo
    array_position($foobar, foo::text) is not null
    seems to be one way to do this, but its not the nicest one
    Richard Dallaway
    @d6y
    @lalnuo @sherpal I've been trying/tracking reasonable ways to do plain sql IN clauses. This is what I have: https://github.com/d6y/plain-in (it's not a library; just example code).
    Antoine Doeraene
    @sherpal
    Oh that's nice! Thanks for sharing
    Lalli Nuorteva
    @lalnuo
    Thats cool! Thanks
    Felipe Bonezi
    @felipebonezi

    Hey guys, I've opened a Pull Request to an issue, but AppVeyor is broking and I don't have idea why.
    Can anyone help me? :pray:

    slick/slick#2134

    Richard Dallaway
    @d6y
    Looks like the link to download SBT as part of the build is failing. Not sure if it's transitory, but right now https://piccolo.link/sbt-0.13.17.zip is failing with a 500 error. I can't figure out who runs piccolo.link to report this.
    Richard Dallaway
    @d6y
    Let's see if piccolo comes back today... but then someone with AppVeyor permissions will need to request a rebuild (probably, maybe)
    Lalli Nuorteva
    @lalnuo
    Is there a built in way to retry queries in slick? I have some queries running in transaction and i'd like to retry them N times
    nafg
    @nafg
    No
    Richard Dallaway
    @d6y
    ...but you might be able to roll your own with cleanUp perhaps. https://books.underscore.io/essential-slick/essential-slick-3.html#andfinally-and-cleanup
    Richard Dallaway
    @d6y
    ...or maybe at the level of Future.
    Lalli Nuorteva
    @lalnuo
    Ok, I'll retry on the future level then, thanks!
    dan-vidican
    @dan-vidican
    private class DbWeatherCalculations(tag: Tag)
        extends Table[WeatherCalculationRepresentation](tag, Some("bill_management_v2"), "weather_calculations") {
        def id           = column[Long]("id", O.PrimaryKey, O.AutoInc)
        def createdAt    = column[Timestamp]("created_at", O.AutoInc)
        def billItemId   = column[Long]("bill_item_id")
        def name         = column[String]("name")
        def value        = column[Double]("value")
        def units        = column[String]("units")
        def billRecordId = column[Long]("bill_record_id")
    
        def * = (id.?, createdAt.?, billItemId, name, value, units, billRecordId)
            .<>( (WeatherCalculationRepresentation.apply _).tupled, WeatherCalculationRepresentation.unapply)
      }

    Hi,
    I have this problem where 'units' has it's own data type in postgresql which is kind of enumeration. When I try to make an insertion I get this error:

    ERROR: column \"units\" is of type public.units but expression is of type character varying\n Hint: You will need to rewrite or cast the expression.\n

    Any suggestion about how I can cast the column 'units' to the one from db? Thanks

    Antoine Doeraene
    @sherpal
    Are you using the slick-pg extension ?
    dan-vidican
    @dan-vidican
    nope
    Miklos Szots
    @smiklos

    Hi folks,

    I'm having an issue when using intellj and slick.
    In any of our slick heavy classes, autocomplete doesn't show implicit extension methods (imported via the postgres api).
    I blame intellj for this but they do show up in the very same codebase using the same intellj version on a colleague's pc.
    Implicits from ColumnExtensionMethods do show up, but extensions from AnyOptionExtensionMethods don't show up.

    Have someone encountered a similar issue before?

    Dheeraj Karande 🇮🇳
    @dheerajkarande_twitter
    Guys i need some help. I am looking for slick oracle example. Please share a link if there is any.
    Anirudh Vyas
    @AnirudhVyas
    I noted an exception this morning:
    failed to ingest due to: java.util.concurrent.RejectedExecutionException: Task slick.basic.BasicBackend$DatabaseDef$$anon$2@727ea248 rejected from slick.util.AsyncExecutor$$anon$2$$anon$1@7cb95277[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 23] any ideas on what it means? supposedly my connection pool terminated?
    Anirudh Vyas
    @AnirudhVyas

    it fails during an insert:

    failed to ingest due to: java
    .util.concurrent.RejectedExecutionException: Task slick.basic.BasicBackend$DatabaseDef$$anon$2@727ea248 rejected from slick.util.AsyncExecutor$$anon$2
    $$anon$1@7cb95277[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 23]
            at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2047)
            at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:823)
            at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1369)
            at slick.util.AsyncExecutor$$anon$2$$anon$3.execute(AsyncExecutor.scala:118)
            at slick.basic.BasicBackend$DatabaseDef.runSynchronousDatabaseAction(BasicBackend.scala:231)
            at slick.basic.BasicBackend$DatabaseDef.runSynchronousDatabaseAction$(BasicBackend.scala:229)
            at slick.jdbc.JdbcBackend$DatabaseDef.runSynchronousDatabaseAction(JdbcBackend.scala:37)
            at slick.basic.BasicBackend$DatabaseDef.runInContext(BasicBackend.scala:208)
            at slick.basic.BasicBackend$DatabaseDef.runInContext$(BasicBackend.scala:140)
            at slick.jdbc.JdbcBackend$DatabaseDef.runInContext(JdbcBackend.scala:37)
            at slick.basic.BasicBackend$DatabaseDef.runInternal(BasicBackend.scala:76)
            at slick.basic.BasicBackend$DatabaseDef.runInternal$(BasicBackend.scala:75)
            at slick.jdbc.JdbcBackend$DatabaseDef.runInternal(JdbcBackend.scala:37)
            at slick.basic.BasicBackend$DatabaseDef.run(BasicBackend.scala:73)
            at slick.basic.BasicBackend$DatabaseDef.run$(BasicBackend.scala:73)
            at slick.jdbc.JdbcBackend$DatabaseDef.run(JdbcBackend.scala:37)
            at com.workday.perftool.query.persistence.RequestPersistors$.com$workday$perftool$query$persistence$RequestPersistors$$save(Persistor.scala:35)

    code for insert is pretty simple and obvious and works most of the time,

    b.run[Unit](DBIO.seq(executableRequestQueryTable += a))

    any suggestions welcome

    nvm race condition :) pool was shutdown
    maha-dot
    @maha-dot

    hello !
    I need your help I have a case class like

    case class SystemResult(id: Int, centerPublicId: CenterPublicId, url: String, username: String, externalId: Option[String], updatedAt: LocalDateTime, lastSync: Option[LocalDateTime] = None)

    and I need to display implicit val with complex values

    implicit val getSystemResults: GetResult[SystemResult] = GetResult(r => SystemResult(r.<<, r.<<, r.<<, r.<<, r.<<, r.<<, r.<<))

    can someone help me please

    Richard Dallaway
    @d6y
    Hi @maha-dot - you'll need to implement an implicit GetResult for CenterPublicId, LocalDateTime and take care with the option values. There's a tutorial on this here: https://books.underscore.io/essential-slick/essential-slick-3.html#select-with-custom-types
    maha-dot
    @maha-dot
    thanks @d6y
    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.