New Book: Learning SLICK for beginners

1,832 views
Skip to first unread message

Adam Mackler

unread,
Oct 25, 2012, 12:38:05 PM10/25/12
to scala...@googlegroups.com
That's what I need.  A book to teach me SLICK, written with the understanding that I'm learning Scala at the same time.

Did you think I meant that there is such a book?  I suppose I should have put the word "wanted" into the subject.  Do you feel deceived and misled?  Now I feel guilty.  I'll tell you what: I'll try to make it up to you.

Since the existing SLICK documentation is somewhat...um...limited, but yet since SLICK seems to be a totally solid, reliable, bug-free library and the work of people who know what they're doing, I've determined to persevere through learning it as best I can.  As an aid to my limited cognitive ability I have been taking copious notes as I progress.  These notes have been accumulating for some time now, and while I cannot send you to the webpage of that new comprehensive SLICK tutorial published by O'Reilly, I can share what I've written.  As far as tutorials go, it's not complete...it's barely begun.  But considering the alternatives it might be worth looking at.  I call it:


I'll admit my motivation in posting this is as much self-interest as altruism: if I can help others follow the trail I've blazed, that's great, but I'm also hoping some of you who know more than I do will send me constructive feedback so I can enhance what learning I have achieved, as well as improve the document for others who read it.

That is all.
--
Adam Mackler

Tanner Ezell

unread,
Oct 25, 2012, 12:45:11 PM10/25/12
to scala...@googlegroups.com
To say the documentation is limited is being pretty generous, thanks for your efforts this looks promising. The unsigned certificate for the website is a little disconcerting.. 


--
 
 
 

Tanner Ezell

unread,
Oct 25, 2012, 1:35:48 PM10/25/12
to scala...@googlegroups.com
One thing that would probably be helpful to others just starting out is including a section on how to use connection pooling to improve the performance of the system.

nafg

unread,
Oct 26, 2012, 2:10:29 AM10/26/12
to scala...@googlegroups.com
That's really nice of you!

Do you know that you can contribute to the site documentation? It's contained in the github repository, under src/main/sphinx.

P.S. You can use a custom type without much work, as long as you can convert it to and from a type that Slick knows about (has an implicit TypeMapper for). Just call MappedTypeMapper.base with one function for each conversion direction, and it will give a you a new TypeMapper.

Stefan Zeiger

unread,
Oct 26, 2012, 5:52:19 AM10/26/12
to scala...@googlegroups.com
On 2012-10-25 18:38, Adam Mackler wrote:
new comprehensive SLICK tutorial published by O'Reilly, I can share what I've written.  As far as tutorials go, it's not complete...it's barely begun.  But considering the alternatives it might be worth looking at.  I call it:


Very nice! I read the first chapters and it looks very promising so far. I've added a link to it in a new 3rd-party documentation section on http://slick.typesafe.com/docs/

--
Stefan Zeiger
Typesafe - The software stack for applications that scale
Twitter: @StefanZeiger

Erik Post

unread,
Oct 26, 2012, 1:53:40 PM10/26/12
to scala...@googlegroups.com
Looks great! I'm sure this will turn out to be quite handy.

Cheers,
Erik

Simon Ochsenreither

unread,
Oct 26, 2012, 6:26:27 PM10/26/12
to scala...@googlegroups.com
Very cool. I think with Scala, Play, Akka pretty well covered SLICK was the last thing missing some paper option.

I hope we get Type Providers fast enough, so that they can be covered in the book, too.

Jacobus

unread,
Oct 30, 2012, 6:21:30 AM10/30/12
to scala...@googlegroups.com
Very nice start Adam! Great writing style also.

My wish-list for your book:
- Primary key examples: Manual, Auto Increment, GUID
- Implementation strategies: How to make the split between your business (domain) logic and your database layer, or do they become the same thing.
- A really simple CRUD example application that covers at mappers to case classes and many to many relationships

Keep going! It's great. You can register as an Amazon author and have buy your own copy before the weekend ;-)

Cheers,
Jacobus

Stefan Zeiger

unread,
Nov 5, 2012, 11:24:27 AM11/5/12
to scala...@googlegroups.com
On 2012-10-25 18:38, Adam Mackler wrote:


Regarding chapter 7 (Custom Data Types): Good explanation for the advanced TypeMapper stuff, but I wouldn't use that as a first example. In most cases a simple MappedTypeMapper should be all you need (cf. https://github.com/slick/slick/blob/da339ad92449f9b04c98c2460ecb9d8553dafdef/slick-testkit/src/main/scala/com/typesafe/slick/testkit/tests/MapperTest.scala#L90)

Adam Mackler

unread,
Nov 6, 2012, 3:24:35 PM11/6/12
to scala...@googlegroups.com
Thanks very much Stefan for the feedback and suggestion, and also to Tanner, nafg, Jacobus, and everyone else for the kind words and encouragement.  I am enqueuing your suggestions.  I work on this in my spare time, which comes as it comes, but please know that I have received and accepted your input.

Adam Mackler

PS: apologies for my ghetto SSL cert.  If the signature bothers you, you can connect to port 80 and get the same content without transport layer security.  Of course, don't blame me if evil hackers slip you some bad documentation.

Pradeep Kumar Mishra

unread,
Nov 12, 2012, 7:46:53 PM11/12/12
to scala...@googlegroups.com
Thanks a lot Adam. Really appreciate your efforts in putting this book together, which I am sure going to be a boon for newbies like me.

Cheers,
Pradeep

sparky...@gmail.com

unread,
Dec 29, 2012, 9:46:25 PM12/29/12
to scala...@googlegroups.com
I'm getting a blank page. Have you taken this offline or is it just down temporarily?




Mark

Sylvain Robez-Masson

unread,
Jan 3, 2013, 6:26:26 AM1/3/13
to scala...@googlegroups.com
Same problem

Troy Payne

unread,
Jan 3, 2013, 11:57:08 AM1/3/13
to scala...@googlegroups.com
blank for me as well

Sylvain Robez-Masson

unread,
Jan 31, 2013, 8:37:53 AM1/31/13
to scala...@googlegroups.com
Now it works :-)

Roberto Leibman

unread,
Jan 31, 2013, 4:43:09 PM1/31/13
to scala...@googlegroups.com
Thanks for the effort in the book! Very minor Nit to pick: You use effect in places where you should use affect.


On Thursday, October 25, 2012 9:38:05 AM UTC-7, Adam Mackler wrote:

Joyce Chan

unread,
Mar 30, 2013, 9:50:37 AM3/30/13
to scala...@googlegroups.com
Hi Adam

I am going through your book.  And I am stuck in this part in chapter 7 where I have to define the SidTypeMapper.  After adding it to my file, I get this error.

object creation impossible, since method sqlTypeName in trait TypeMapperDelegate of type => String is not defined

Do you have another place that is more appropriate for discussing matters relating to your book.  Thanks for the work thus far, it has been incredibly useful in helping me understand Slick.

Joyce 

On Thursday, October 25, 2012 12:38:05 PM UTC-4, Adam Mackler wrote:

Adam Mackler

unread,
Oct 7, 2013, 4:42:30 PM10/7/13
to scala...@googlegroups.com
On Saturday, March 30, 2013 9:50:37 AM UTC-4, Joyce Chan wrote:
Hi Adam

I am going through your book.  And I am stuck in this part in chapter 7 where I have to define the SidTypeMapper.  After adding it to my file, I get this error.

object creation impossible, since method sqlTypeName in trait TypeMapperDelegate of type => String is not defined

Do you have another place that is more appropriate for discussing matters relating to your book.  Thanks for the work thus far, it has been incredibly useful in helping me understand Slick.

Joyce 

Dear Joyce:

Please forgive me for the inexcusably untimely delay in responding to your post.  I had neglected to set this thread to forward messages to my email, and just now read your message for the first time.

If you are still having this issue let me know. 

--
Adam Mackler

Adam Mackler

unread,
Nov 21, 2013, 6:18:24 AM11/21/13
to scala...@googlegroups.com
Update:

I am no longer working on this document, due to the changes of Slick version 2.  I have a new version at the following links:

I'll leave the old version up, for now at least.

Again, this is a work-in-progress, basically the notes I take for myself as I learn about different aspects of Slick.  It's not complete, and maybe never will be, but if anyone finds it useful, there it is.

--
Adam Mackler


Brian Schlining

unread,
Nov 21, 2013, 12:05:12 PM11/21/13
to scala...@googlegroups.com
Hey Adam,
Thanks for sharing that!
Brian

--
 
---
You received this message because you are subscribed to the Google Groups "Slick / ScalaQuery" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalaquery+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Neil Chaudhuri

unread,
Dec 15, 2013, 9:29:41 PM12/15/13
to scala...@googlegroups.com
Great job indeed.

I would suggest the following topics if you get time since they seem to come up often:
  • Working around the Catch 22 tuple limit
  • Auto incremented primary keys
  • Single-table inheritance and other types
I would also request the following:
  • Callbacks (like on update always do this)
  • Sharing common behavior (like if every model has a findById method. Somewhat related to the inheritance topic described previously)
  • Calling database-specific functions like full-text search queries in Oracle or Postgres
Thank you for your hard work! You can probably publish this eventually. Please don't forget the little people who knew you before you got famous.

Adam Mackler

unread,
Dec 15, 2013, 9:39:43 PM12/15/13
to scala...@googlegroups.com
On Sunday, December 15, 2013 9:29:41 PM UTC-5, Neil Chaudhuri wrote:
I would also request the following:
  • Callbacks (like on update always do this)
  • Calling database-specific functions like full-text search queries in Oracle or Postgres
    Thank you for the kind feedback.  Can you clarify the above two points?  I'm unfamiliar with both the meaning of "callback" and a "full-text search query" in Postgres.

    --
    Adam Mackler

    Sven Pedersen

    unread,
    Dec 16, 2013, 4:09:34 PM12/16/13
    to scala...@googlegroups.com
    Thanks, Adam! Your book looks very good.
    On the 22 column limit, I've got a discussion with Mr. Vogt on StackOverflow that addresses it. I've not quite resolved all aspects of mapping, etc.
    http://stackoverflow.com/questions/20555304/how-can-i-use-the-new-slick-2-0-hlist-to-overcome-22-column-limit

    You might try a free SSL cert from StartSSL.com, instructions below
    https://konklone.com/post/switch-to-https-now-for-free

    --Sven
    Reply all
    Reply to author
    Forward
    0 new messages