Re: Database Router Abstract Base Class (ABC)

2019-04-29 Thread Adam Johnson
I'm a bit ambivalent on adding such a class. Many features even in core Python don't provide base classes and instead rely on duck-typing + documentation. The amount of time saved globally will probably be less than the time we've spent discussing it so far. I think a more valuable piece of code w

Re: Database Router Abstract Base Class (ABC)

2019-04-28 Thread Rick van Hattem
On Sun, 28 Apr 2019 at 11:30, Adam Johnson wrote: > I don't think this would be that helpful, Django relies on ducktyping, and > the router docs ( > https://docs.djangoproject.com/en/2.2/topics/db/multi-db/ ) clearly > document the signatures, and that the methods are all optional: > > A router d

Re: Database Router Abstract Base Class (ABC)

2019-04-28 Thread Adam Johnson
I don't think this would be that helpful, Django relies on ducktyping, and the router docs ( https://docs.djangoproject.com/en/2.2/topics/db/multi-db/ ) clearly document the signatures, and that the methods are all optional: A router doesn’t have to provide *all* these methods – it may omit one or

Database Router Abstract Base Class (ABC)

2019-04-28 Thread Rick van Hattem (wolph)
Hi guys, It seems to me that an (abstract) base class for the database routers would be useful to inherit for people. Makes implementing a router slightly easier. I was thinking something along these lines: import abc class ConnectionRouterBase(abc.ABC): @abstractmethod def db_for_re