Opened 15 years ago

Closed 15 years ago

Last modified 13 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: no UI/UX: no

Description

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 Gaynor 15 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 by Russell Keith-Magee, 15 years ago

milestone: 1.2
Triage Stage: UnreviewedAccepted

by Alex Gaynor, 15 years ago

Attachment: django-multidb-cursor.diff added

comment:2 by Alex Gaynor, 15 years ago

Has patch: set
Triage Stage: AcceptedReady for checkin

comment:3 by Russell Keith-Magee, 15 years ago

Resolution: fixed
Status: newclosed

(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 by Jacob, 13 years ago

milestone: 1.2

Milestone 1.2 deleted

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