Opened 6 years ago

Closed 6 years ago

Last modified 4 years ago

#12941 closed (fixed)

multiple database connections cursors

Reported by: atlithorn@… Owned by: nobody
Component: Documentation Version: 1.2-beta
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


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.

Attachments (1)

django-multidb-cursor.diff (684 bytes) - added by Alex 6 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 6 years ago by russellm

  • milestone set to 1.2
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Changed 6 years ago by Alex

comment:2 Changed 6 years ago by Alex

  • Has patch set
  • Triage Stage changed from Accepted to Ready for checkin

comment:3 Changed 6 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(In [12709]) Fixed #12941 -- Added documentation for the connections dictionary. Thanks to atlithorn@… for the report, and Alex Gaynor for the original text.

comment:4 Changed 4 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top