Monday, August 26, 2013

Slick: 5 seconds of hate

Simple reminder why I hate ORM. Some daily experience from trying to make Slick doing something more useful than the examples they generously provide in the very incomplete and hazy documentation (I just wanted to count the rows in some query):

Warning #1:
method count in class ColumnExtensionMethods is deprecated: Use Query.count instead

After some code changes and more esoteric responses from the compiler, I get this:

Warning #2:
method count in class Query is deprecated: Use .length instead of .count


++ to add more misery to insult, I can't print out the SQL statement that this thing generates to get the row count, because it's now a method of a query! (Of course, there are always the database logs...)


Update:  as a result of this rant, I had a quick twitter conversation with , who explained that will give the result I want, and Query(myQuery.length).selectStatement would produce the SQL, and that in Slick 2.0.0, that's coming out somewhere in September, it will be possible to write myQuery.length.selectStatement directly. That is nice, except that Slick 2.0.0 won't be backwards compatible, which probably means that the ongoing projects might not be able to benefit from the new library, unless people are already using alpha version of 2.0.0 (which we don't).

Nevertheless, good to know that someone's working on the problem :-}

No comments:

Post a Comment