动态更改我也连接的数据库分片 [英] Dynamically changing the database shard that I am connecting too

查看:40
本文介绍了动态更改我也连接的数据库分片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个数据库连接池,连接到各种分片数据库.

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

在每个查询的基础上,我将传入租户/客户 ID,并根据客户 ID 选择要连接和用于当前查询的数据库.

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.

开箱即用的 Slick 可以做到这一点吗?

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

推荐答案

不支持开箱即用,但我认为不应该太难实现.我创建了一张票:https://github.com/slick/slick/issues/703

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

这篇关于动态更改我也连接的数据库分片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆