Where communities thrive


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

    Hello Guys!
    I couldn't find any answer in slick documentation https://books.underscore.io/essential-slick/essential-slick-3.html (perhaps my poor search skills)
    My question is, I have the following query construction:

    messages.filter(_.sender === "Dave")

    But in practice folk does

    messages.filter(_.sender === "Dave".bind)

    What is the difference and why is it motivated to do so?
    I tinkered a little in REPL with slick, and that is all I've got:

    scala> messages.filter(_.sender === "Dave").result.statements.toString
    res7: String = List(select "sender", "content", "id" from "message" where "sender" = 'Dave')
    
    scala> messages.filter(_.sender === "Dave".bind).result.statements.toString
    res8: String = List(select "sender", "content", "id" from "message" where "sender" = ?)

    In the first case we got query with static injected value in it, it is in '' and I think there is no danger of sql injection.
    In second scenario we've got just placeholder, in this case when the values are actually will be inserted in query?
    why the second case with .bind preferable?

    Sorry for my terrible english with a lot of syntax error's

    Richard Dallaway
    @d6y
    I think the bind version is, in principle, reusable (for different values) by the database/jdbc-land. That would save the database from making a new queey plan for each call. In practice, I don’t know if that actually happens. I’m hoping others can confirm/refute that.
    Queey? Query plan, I mean!
    oybek
    @oybek
    How can I reuse and substitute different value is such a case?
    1 reply
    micky44
    @Micky44Scoll_twitter
    Have slick support scala 3?
    nafg
    @nafg
    @oybek a while ago, @szeiger made a scala 3 version but I don't think I got merged or published
    Sorry that was for @Micky44Scoll_twitter
    Seth Tisue
    @SethTisue
    @nafg @Micky44Scoll_twitter the Scala 3 PR has been revived at slick/slick#2187 — I'm not sure how close to complete it is
    if you think you might have any spare time to help out, please subscribe to that PR (and/or slick/slick#2177) and keep an eye out for opportunities to help keep it moving
    Seth Tisue
    @SethTisue
    oh btw anyone interested in the future of Slick might also be interested in:
    also slick/slick#2169 about updating versions of the database connectors
    Seth Tisue
    @SethTisue
    looks like we're on track for a 3.4.0 release, maybe in April?
    nafg
    @nafg
    @SethTisue anything I can do to help?
    Seth Tisue
    @SethTisue
    @nafg absolutely, please help review pull requests! including perhaps adopting and resubmitting abandoned ones if the original person has disappeared
    and test an RC once we have one
    and help the Scala 3 guy if he needs it, that one is huge. it isn't clear yet what kind of help he might need
    help re-enabling Appveyor so we don't regress on Windows would be awesome: slick/slick#2178
    (or use GitHub Actions for Windows testing.... either way)
    perhaps there are other important tickets that I don't even recognize the importance of because I know nothing about Slick. I'm engaging with it just as generic Scala OSS
    we'll roll an RC as soon as the current round of PRs finishes landing
    once there's an RC I'm going to do a round of publicity (on Twitter, Discourse, Reddit, and so forth) in the hopes of attracting testers and others kinds of help
    nafg
    @nafg
    @SethTisue any kind of timeline? I'd love to help but right now is not great
    Seth Tisue
    @SethTisue

    @nafg I think we'll be ready to do an RC in about two weeks, and then after that wait a month or so, minimum, before final? maybe longer depending on how the RC is received?

    but also, I'm not just trying to get one release out, I'm hoping this can be self-sustaining again going forward, for as long as people are still using the library

    nafg
    @nafg
    Ok my time is limited right now but if anyone wants to do a video call with me it could happen sooner
    nafg
    @nafg
    @SethTisue do you have any interest?
    Seth Tisue
    @SethTisue
    @nafg sure — write me at seth dot tisue at lightbend dot com and we can set it up. I'm not exactly sure what you have in mind or if I can help, but talking never hurts :-) I'm in Nevada/California time zone and free most weekday mornings
    James Phillips
    @jdrphillips
    I'd like to write my own DatabaseAction that does a special thing. But it doesn't seem it's possible as Database.run won't anticipate it. Is that correct?
    Richard Dallaway
    @d6y
    Yeah, that looks right @jdrphillips -- DBIOAction is a sealed trait. What do you want to achieve? There's likely another way we can try to think up!
    James Phillips
    @jdrphillips
    DBIOAction is sealed but DatabaseAction is not, so I hoped it may have been possible to sneak something in

    What do you want to achieve?

    I wanted to implement something like "clean up" actions. Attach an effect to your DBIO, and carry it around with you across all the flatmaps/andthens etc, and then when it is eventually run tack the effects on to the future as a side-effect.

    Imagine something like a huge dbio transaction that at some point changes a user's subscription settings. At that point in the DBIO, I know I have to send an email to the user. It would be handy to at that point attach it (the send-email effect) to the DBIO and have it dealt with alongside the transaction execution automatically (if the transaction succeeds)

    It's probably something to do properly on top of slick, I know that - but everything is already a DBIO in our code and I wanted an easy way to slip it in, that's all :)
    James Phillips
    @jdrphillips
    (I could of course turn the email-effect into a future and then into a DBIO and have it sit in the middle of the DB transaction but I don't want to do that)
    Richard Dallaway
    @d6y
    I wonder if cleanUp or andFinally on an action are a place you could do some of that.
    James Phillips
    @jdrphillips
    andFinally seems to inject things into the middle of the DBIO structure, rather than keeping them at the end. From my understanding anyway. So if we ended up rolling the transaction back the email would be sent in error
    I admit I didn't look too closely at cleanup as it seemed to be about errors but I'll have a closer look
    Richard Dallaway
    @d6y
    James Phillips
    @jdrphillips
    thanks
    Seth Tisue
    @SethTisue
    hey, all: PR reviewers wanted; I've added the "needs review" label to a number of PRs at https://github.com/slick/slick/pulls
    if you'd looked before but PRs were waiting for rebasing or waiting for CI to run, I think that's all shaken out now, or nearly so
    Seth Tisue
    @SethTisue
    tweet seeking PR reviewers; retweets appreciated https://twitter.com/SethTisue/status/1376599766751084547
    Aleksey Izmailov
    @izmailoff
    Hi there! I hope that’s a good place to ask. What is the status of Slick migration/support of Scala 3/Dotty? I’ve tried to use latest Slick compiled for 2.13 with Scala 3, but getting some errors even after fixing obvious things. I understand implicits and macros would have to take care of. Thanks.
    Rohan Sircar
    @rohan-sircar
    @izmailoff there's a PR in progress for it slick/slick#2187
    Aleksey Izmailov
    @izmailoff
    Thanks @rohan-sircar that's nice to see!
    Rohan Sircar
    @rohan-sircar
    I'm hopeful to see scala3 support for slick myself :)
    Seth Tisue
    @SethTisue
    any assistance you can offer on the PR would be welcome
    Aleksey Izmailov
    @izmailoff
    @SethTisue I'll see if I can contribute in any meaningful way
    Seth Tisue
    @SethTisue
    @izmailoff :+1:
    Rohan Sircar
    @rohan-sircar
    take my energy ༼ つ ◕_◕ ༽つ
    Tim Nielens
    @tnielens
    Hello,
    I bumped into an issue with the combination of slick's distinctOn(_.id) and mysql bit(1) data type for a Boolean scala field.
    The distinct slick clause seems to produce a sql query where all queried fields are aggregated with min(...) like this example select min(field1), min(field2), min(myBit1Field) from ... group by id. Unfortunately, that aggregation doesn't play well with mysql's bit(1) which in my case ends up being truein my scala object when the record field in DB is 0x00 (false).
    Is this a known issue?
    Tim Nielens
    @tnielens
    I'm using slick 3.3.3