Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Allow multiple pools #28

Open
arski opened this issue Jul 8, 2012 · 6 comments
Open

Allow multiple pools #28

arski opened this issue Jul 8, 2012 · 6 comments

Comments

@arski
Copy link

arski commented Jul 8, 2012

Hi again,

I'm pretty sure this is really not possible in the module: I have an app that works with two different databases (for various reasons), but obviously Twistar only allows one Registry.DBPOOL connection.. Is there anything that could be done to increase this number? Or either way, what would you recommend to do in such a scenario?

Thanks again,
Martin

@arski
Copy link
Author

arski commented Jul 8, 2012

Hmm, I see I can simply create other pools via Registry.DBPOOL2 = ... e.g. But is that OK to do? Will the pool run as properly as the first?

@erikkaplun
Copy link
Contributor

I have the same question. Can I simply assign independent DB pools to model classes?

@bmuller
Copy link
Owner

bmuller commented Dec 1, 2012

Right now, there's no concept of having multiple pools (let alone, one per class). The only way to get around it would be to manually switch out the value of Registry.DBPOOL to be the pool you want to use for subsequent queries. Not great - I know - but it would require making some pretty big changes to allow for a different pool per class. I'll add this to the list of feature requests.

@isnok
Copy link

isnok commented Sep 12, 2013

But wouldn't changing Registry.DBPOOL at run time affect simultaneously running transactions?
I was thinking through another approach: double-importing.
Outcome: Will also not work, because other submodules import registry via 'full path'. That will always resolve to the same module instance, even if called from different places.

@netanelkl
Copy link

I'm also quite interested in that idea, on don't think it would be extremely difficult.
I'll try to work on that over the next week and make a PR for review.

@morfair
Copy link

morfair commented Sep 27, 2016

It's very important features! I need in this too.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants