1

I want to have a pool of database connections, connecting to various sharded databases.

On a per query basis I will pass in the tenant/customerId, and based on the customerId I will choose which database to connect and use for the current query.

Is this something that can be done with Slick out of the box?

cvogt
  • 11,260
  • 30
  • 46
loyalflow
  • 14,275
  • 27
  • 107
  • 168

1 Answers1

2

Not supported out of the box, but shouldn't be too hard to implement I think. I created a ticket: https://github.com/slick/slick/issues/703

cvogt
  • 11,260
  • 30
  • 46
  • Great. Again, this is simply being able to choose or pass in which datasource to use. The logic to choose can even be done outside of slick and we simply pass in the datasource. Or have some way of overriding that logic so I could figure out the datasource by say hashing, or using redis, etc. This is not cross communicating between shards. – loyalflow Mar 11 '14 at 15:12
  • Yep, that's what I figured. This particular use case should be not too hard to implement even with automatic dispatching of queries to the right shard. But nothing in place yet. – cvogt Mar 11 '14 at 17:12
  • No, and not to expect in the near future. The ticket is just for the record. It is not scheduled in our roadmap until the summer. Please consider a contribution to Slick or try to make a case that there is a high interest in this on the mailing list. – cvogt Mar 17 '14 at 22:47
  • I added some pointers to the ticket. Be aware, that with "shouldn't be hard to implement" I assume prior knowledge with Slick internals, which can be a hurdle. https://github.com/slick/slick/issues/703 – cvogt Apr 06 '14 at 11:10