Opened 5 years ago

Closed 5 years ago

#10459 closed (fixed)

Database connections should know their own settings

Reported by: Alex Owned by: Alex
Component: Database layer (models, ORM) Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: UI/UX:


This makes both logical sense and it makes multidb way easier.

Attachments (1)

diff.diff (18.8 KB) - added by Alex 5 years ago.
Hits this in every place(I think) but doesn't resolve issues with the test database, that neesd thought

Download all attachments as: .zip

Change History (3)

Changed 5 years ago by Alex

Hits this in every place(I think) but doesn't resolve issues with the test database, that neesd thought

comment:1 Changed 5 years ago by Alex

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

comment:2 Changed 5 years ago by adrian

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

(In [10026]) Fixed #10459 -- Refactored the internals of database connection objects so that connections know their own settings and pass around settings as dictionaries instead of passing around the Django settings module itself. This will make it easier for multiple database support. Thanks to Alex Gaynor for the initial patch.

This is backwards-compatible but will likely break third-party database backends. Specific API changes are:

  • BaseDatabaseWrapper.init() now takes a settings_dict instead of a settings module. It's called settings_dict to disambiguate, and for easy grepability. This should be a dictionary containing DATABASE_NAME, etc.
  • BaseDatabaseWrapper has a settings_dict attribute instead of an options attribute. BaseDatabaseWrapper.options is now BaseDatabaseWrapperDATABASE_OPTIONS?
  • BaseDatabaseWrapper._cursor() no longer takes a settings argument.
  • BaseDatabaseClient.init() now takes a connection argument (a DatabaseWrapper instance) instead of no arguments.

Add Comment

Modify Ticket

Change Properties
<Author field>
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.