#12941 closed (fixed)
multiple database connections cursors
Reported by: | 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)
Change History (5)
comment:1 by , 15 years ago
milestone: | → 1.2 |
---|---|
Triage Stage: | Unreviewed → Accepted |
by , 15 years ago
Attachment: | django-multidb-cursor.diff added |
---|
comment:2 by , 15 years ago
Has patch: | set |
---|---|
Triage Stage: | Accepted → Ready for checkin |
comment:3 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
(In [12709]) Fixed #12941 -- Added documentation for the connections dictionary. Thanks to atlithorn@… for the report, and Alex Gaynor for the original text.