On Tuesday, June 1, 2021 at 2:35:17 PM UTC+2 gojeta...@gmail.com wrote:

> I don't see any reason for why providing a hook seems so difficult. 
>

It is more code to maintain, needs tests etc and increases complexity. Just 
because something is easy on the surface, doesn't mean it will be easy in 
the longrun.

A simple implementation can be: (From message-3 of this conversation):
>
>
> > #settings.py
>
> TRANSACTION_DB_SELECTOR = "path_to_some_callable"
>
> #transaction.py
> ...
> transaction_db_selector = import_string(settings.TRANSACTION_DB_SELECTOR)
> def get_connection():
>     if transaction_db_selector:
>         using = transaction_db_selector()
>     if using is None:
>         using = DEFAULT_DB_ALIAS
>     return connections[using]
>

I do not think that completely ignoring the `using` that was passed in by 
the user would be a very good idea (for the case when there is also a 
`TRANSACTION_DB_SELECTOR` set).

Cheers,
Florian

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/016c2d90-302c-45d5-82de-48de66404146n%40googlegroups.com.
  • Re:... 'Adam Johnson' via Django developers (Contributions to Django itself)
    • ... N Aditya
      • ... N Aditya
        • ... N Aditya
          • ... charettes
          • ... 'Adam Johnson' via Django developers (Contributions to Django itself)
          • ... Florian Apolloner
          • ... N Aditya
          • ... Aymeric Augustin
          • ... N Aditya
          • ... Florian Apolloner
          • ... N Aditya
          • ... Lokesh Dokara
          • ... N Aditya
          • ... Aymeric Augustin
          • ... N Aditya
          • ... Shai Berger
          • ... Aymeric Augustin
          • ... N Aditya
          • ... Aymeric Augustin
          • ... AJAY

Reply via email to