Hey Florian, 

I'd like to point out that the code snippet which I wrote is just a scratch 
version of how it might look. I'd first like to reach consensus on the idea 
itself before writing something concrete. 
Obviously it wouldn't be as naive as overriding something that the user 
provided explicitly. 

Regards,
Aditya N

On Tuesday, June 1, 2021 at 6:32:44 PM UTC+5:30 f.apo...@gmail.com wrote:

> 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/9e56624a-f486-4089-b065-13b77aff47d2n%40googlegroups.com.
  • Re:... 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
        • ... Florian Apolloner

Reply via email to