Reputation: 1192
I'm using Slick 2.1 and am doing a fairly standard JOIN. However when I try to limit the number of rows returned using "take()" I get a compile error.
Query...
var samples = for {
(sample, user) <- this
.join(users) on (_.userId === _.id) if user.id === 123
.take(50)
} yield (sample)
The compiler error...
type mismatch; found : Iterable[String] required: scala.slick.lifted.Column[?]
Why can I not simply add in "take()" here?!
Thanks!
Upvotes: 0
Views: 1937
Reputation: 2900
Actually your expression is invalid syntactically: you've inserted a for-comprehension guard statement before trying to make another call in the chain of table transformations.
.join(users) on (_.userId === _.id) if user.id === 123
^ Right here
.take(50)
To fix, you have one of three options:
if
with filter
,if
after the take
,take
to the result of the for
comprehensionUpvotes: 3