multiple database connections cursors
I use connection.cursor for making raw sql queries and needed to access one of the alternate databases in my settings.DATABASES
I had a look through the code and realised that I could just do this
from django.db import connections
cursor = connections['logs'].cursor()
instead of what I had been doing earlier (when everything was in the same database)
from django.db import connection
cursor = connection.cursor()
Multiple database support is really well implemented, I think you should mention the above in your docs somewhere to complete the perfect picture.
milestone: |
→ 1.2
|
Triage Stage: |
Unreviewed → Accepted
|
Has patch: |
set
|
Triage Stage: |
Accepted → Ready for checkin
|
Resolution: |
→ fixed
|
Status: |
new → closed
|
(In [12709]) Fixed #12941 -- Added documentation for the connections dictionary. Thanks to atlithorn@… for the report, and Alex Gaynor for the original text.