Opened 16 years ago
Closed 16 years ago
#10459 closed (fixed)
Database connections should know their own settings
Reported by: | Alex Gaynor | Owned by: | Alex Gaynor |
---|---|---|---|
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: | no | UI/UX: | no |
Description
This makes both logical sense and it makes multidb way easier.
Attachments (1)
Change History (3)
by , 16 years ago
comment:1 by , 16 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
Marking as accepted based on: http://groups.google.com/group/django-developers/browse_thread/thread/5d8c73eb483029af
comment:2 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → 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.
Hits this in every place(I think) but doesn't resolve issues with the test database, that neesd thought