summaryrefslogtreecommitdiff
path: root/django/db/__init__.py
AgeCommit message (Collapse)Author
2024-06-24Fixed #35547 -- Added reset_queries to django.db.__all__.AjmalPonneth
2024-01-22Fixed #35130 -- Doc'd django.db.close_old_connections().Salvo Polizzi
This also adds close_db_connections() to the django.db.__all__.
2022-03-17Prevented initialization of unused database connections.Florian Apolloner
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2020-12-08Fixed #32233 -- Cleaned-up duplicate connection functionality.Florian Apolloner
2019-02-20Removed an outdated comment on DefaultConnectionProxy.Ran Benita
2017-01-19Refs #23919 -- Stopped inheriting from object to define new style classes.Simon Charette
2017-01-18Refs #23919 -- Removed obsolete __ne__() methods.Aymeric Augustin
__ne__() defaults to the opposite of __eq__() on Python 3 when it doesn't return NotImplemented.
2016-11-14Fixed E305 flake8 warnings.Ramin Farajpour Cami
2016-09-26Removed missing name in django.db __all__.Adam Chainz
'backend' hasn't existed since 051c666acac770dea1af2fc223cc695f985f02f7.
2015-06-27Sorted imports in __init__.py files.Tim Graham
2015-05-17Fixed #23820 -- Supported per-database time zone.Aymeric Augustin
The primary use case is to interact with a third-party database (not primarily managed by Django) that doesn't support time zones and where datetimes are stored in local time when USE_TZ is True. Configuring a PostgreSQL database with the TIME_ZONE option while USE_TZ is False used to result in silent data corruption. Now this is an error.
2014-06-11Fixed #21430 -- Added a RuntimeWarning when unpickling Models and QuerySets ↵Anubhav Joshi
from a different Django version. Thanks FunkyBob for the suggestion, prasoon2211 for the initial patch, and akaariai, loic, and charettes for helping in shaping the patch.
2014-06-07Fixed #3711, #6734, #12581 -- Bounded connection.queries.Aymeric Augustin
Prevented unlimited memory consumption when running background tasks with DEBUG=True. Thanks Rob, Alex, Baptiste, and others.
2014-03-21Removed unused imports.Tim Graham
2014-03-21Removed django.db.backend per deprecation timeline.Aymeric Augustin
2014-03-21Removed legacy transaction management per the deprecation timeline.Aymeric Augustin
2014-03-08Fixed #21188 -- Introduced subclasses for to-be-removed-in-django-XX warningsClaude Paroz
Thanks Anssi Kääriäinen for the idea and Simon Charette for the review.
2013-07-08A large number of stylistic cleanups across django/db/Alex Gaynor
2013-07-08Fixed a bug I introduced in my previosu ommit.Alex Gaynor
2013-06-29Advanced deprecation warnings for Django 1.7.Aymeric Augustin
2013-05-23Delayed settings.DATABASE_ROUTERS usage by ConnectionRouterClaude Paroz
Refs #20474.
2013-05-23Delayed settings.DATABASES usage by ConnectionHandlerClaude Paroz
Refs #20474.
2013-05-23Fixed #20474 -- Proxied and deprecated django.db.backendClaude Paroz
2013-03-11Added some assertions to enforce the atomicity of atomic.Aymeric Augustin
2013-03-11Deprecated transaction.commit/rollback_unless_managed.Aymeric Augustin
Since "unless managed" now means "if database-level autocommit", committing or rolling back doesn't have any effect. Restored transactional integrity in a few places that relied on automatically-started transactions with a transitory API.
2013-03-01Added import forgotten in 2ee21d9.Aymeric Augustin
Thanks ratsonale for spotting this mistake.
2013-02-28Fixed tests broken in 2ee21d9.Aymeric Augustin
2013-02-28Implemented persistent database connections.Aymeric Augustin
Thanks Anssi Kääriäinen and Karen Tracey for their inputs.
2013-02-27Refactored database exceptions wrapping.Aymeric Augustin
Squashed commit of the following: commit 2181d833ed1a2e422494738dcef311164c4e097e Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Wed Feb 27 14:28:39 2013 +0100 Fixed #15901 -- Wrapped all PEP-249 exceptions. commit 5476a5d93c19aa2f928c497d39ce6e33f52694e2 Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Tue Feb 26 17:26:52 2013 +0100 Added PEP 3134 exception chaining. Thanks Jacob Kaplan-Moss for the suggestion. commit 9365fad0a650328002fb424457d675a273c95802 Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Tue Feb 26 17:13:49 2013 +0100 Improved API for wrapping database errors. Thanks Alex Gaynor for the proposal. commit 1b463b765f2826f73a8d9266795cd5da4f8d5e9e Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Tue Feb 26 15:00:39 2013 +0100 Removed redundant exception wrapping. This is now taken care of by the cursor wrapper. commit 524bc7345a724bf526bdd2dd1bcf5ede67d6bb5c Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Tue Feb 26 14:55:10 2013 +0100 Wrapped database exceptions in the base backend. This covers the most common PEP-249 APIs: - Connection APIs: close(), commit(), rollback(), cursor() - Cursor APIs: callproc(), close(), execute(), executemany(), fetchone(), fetchmany(), fetchall(), nextset(). Fixed #19920. commit a66746bb5f0839f35543222787fce3b6a0d0a3ea Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Tue Feb 26 14:53:34 2013 +0100 Added a wrap_database_exception context manager and decorator. It re-throws backend-specific exceptions using Django's common wrappers.
2013-02-13Removed try-except in django.db.close_connection()Anssi Kääriäinen
The reason was that the except clause needed to remove a connection from the django.db.connections dict, but other parts of Django do not expect this to happen. In addition the except clause was silently swallowing the exception messages. Refs #19707, special thanks to Carl Meyer for pointing out that this approach should be taken.
2013-02-10Fixed #19707 -- Reset transaction state after requestsAnssi Kääriäinen
2012-10-28Fixed #18575 -- Empty DATABASES should default to dummy backendClaude Paroz
Thanks delormemarco@gmail.com for the report.
2011-12-16Fixed #17258 -- Moved `threading.local` from `DatabaseWrapper` to the ↵Julien Phalip
`django.db.connections` dictionary. This allows connections to be explicitly shared between multiple threads and is particularly useful for enabling the sharing of in-memory SQLite connections. Many thanks to Anssi Kääriäinen for the excellent suggestions and feedback, and to Alex Gaynor for the reviews. Refs #2879. git-svn-id: http://code.djangoproject.com/svn/django/trunk@17205 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-07-13Fixed #16225 -- Removed unused imports. Many thanks to Aymeric Augustin for ↵Jannis Leidel
the work on the patch and Alex for reviewing. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16539 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-30Removed legacy handing for `settings.DATABAS_*` and using short-form ↵Alex Gaynor
references to the included database backends. git-svn-id: http://code.djangoproject.com/svn/django/trunk@15959 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-28Removed a bunch more Python 2.4 workarounds now that we don't support that ↵Adrian Holovaty
version. Refs #15702 -- thanks to jonash for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@15927 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-02-19Fixed #15336 -- Silenced a warning about the DATABASES transition when a ↵Russell Keith-Magee
database backend isn't specified. Thanks to Ivan Sagalaev for the report and patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@15571 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-11Fixed #14436 -- Escalated 1.2 PendingDeprecationWarnings to ↵Russell Keith-Magee
DeprecationWarnings, and removed 1.1 deprecated code. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14138 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-06Fixed #14395 -- Fixed typo in error message in db/__init__.py. Thanks, agabelAdrian Holovaty
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13990 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-08-05Fixed #13610 -- Improved error reporting when the ENGINE setting is ommitted ↵Russell Keith-Magee
from a database configuration. Thanks to Gregor Müllegger for the report and patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@13489 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-29Fixed #12702 -- Introduced a common implementation of DatabaseError and ↵Russell Keith-Magee
IntegrityError, so that database backends can (re)raise common error classes. Thanks for Waldemar Kornewald for the report. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12352 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-22Fixed #12540, #12541 -- Added database routers, allowing for configurable ↵Russell Keith-Magee
database use behavior in a multi-db setup, and improved error checking for cross-database joins. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12272 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-28Fixed #12452 -- Ensured that all connections are closed when a request is ↵Russell Keith-Magee
finished. Thanks to samuel@lefora.com for the report and fix. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12008 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-22Fixed #1142 -- Added multiple database support.Russell Keith-Magee
This monster of a patch is the result of Alex Gaynor's 2009 Google Summer of Code project. Congratulations to Alex for a job well done. Big thanks also go to: * Justin Bronn for keeping GIS in line with the changes, * Karen Tracey and Jani Tiainen for their help testing Oracle support * Brett Hoerner, Jon Loyens, and Craig Kimmerer for their feedback. * Malcolm Treddinick for his guidance during the GSoC submission process. * Simon Willison for driving the original design process * Cal Henderson for complaining about ponies he wanted. ... and everyone else too numerous to mention that helped to bring this feature into fruition. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11952 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-16Fixed #10833 -- Corrected load_backend so that it actually loads the ↵Russell Keith-Magee
requested backend, rather than always loading settings.DATABASE_BACKEND. Thanks to Alex Gaynor for the report and fix. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10560 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-18Fixed #8193: all dynamic imports in Django are now done correctly. I know ↵Jacob Kaplan-Moss
this because Brett Cannon borrowed the time machine and brought Python 2.7's '`importlib` back for inclusion in Django. Thanks for the patch-from-the-future, Brett! git-svn-id: http://code.djangoproject.com/svn/django/trunk@10088 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-13Improved the error message in case of an invalid DATABASE_BACKEND to ignore ↵Adrian Holovaty
'.svn' directories in displaying the list of valid backends git-svn-id: http://code.djangoproject.com/svn/django/trunk@10046 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-13Fixed #10487 -- Refactored the database-backend-selection logic into a ↵Adrian Holovaty
function, django.db.load_backend. Thanks to Alex Gaynor for the initial patch git-svn-id: http://code.djangoproject.com/svn/django/trunk@10045 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-11Fixed #10459 -- Refactored the internals of database connection objects so ↵Adrian Holovaty
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 BaseDatabaseWrapper['DATABASE_OPTIONS'] * BaseDatabaseWrapper._cursor() no longer takes a settings argument. * BaseDatabaseClient.__init__() now takes a connection argument (a DatabaseWrapper instance) instead of no arguments. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10026 bcc190cf-cafb-0310-a4f2-bffc1f526a37