Connect to multiple databases programmtically?

Hi, in my use case the worker would be connecting to different databases based on a parameter of the url, for instance:

I’ve noticed that I have to connect the worker beforehand to a D1 instance but will this use case ever be supported ?