summaryrefslogtreecommitdiff
path: root/django/db/backends/base/base.py
AgeCommit message (Collapse)Author
2025-12-19Fixed #36487 -- Fixed logger error message with partial callbacks.Krishnaprasad MG
2025-07-23Refs #36500 -- Rewrapped long docstrings and block comments via a script.django-bot
Rewrapped long docstrings and block comments to 79 characters + newline using script from https://github.com/medmunds/autofix-w505.
2025-03-30Fixed warnings per flake8 7.2.0.Mariusz Felisiak
https://github.com/PyCQA/flake8/releases/tag/7.2.0
2025-02-18Refs #36005 -- Used datetime.UTC alias instead of datetime.timezone.utc.Mariusz Felisiak
datetime.UTC was added in Python 3.11.
2024-08-28Refs #12581 -- Adjusted warning stacklevel in queries ring buffer.Simon Charette
2024-03-01Refs #33497 -- Added connection pool support for PostgreSQL.Sarah Boyce
Co-authored-by: Florian Apolloner <florian@apolloner.eu> Co-authored-by: Ran Benita <ran@unusedvar.com>
2023-01-18Fixed #34233 -- Dropped support for Python 3.8 and 3.9.Mariusz Felisiak
2023-01-17Refs #32365 -- Removed support for pytz timezones per deprecation timeline.Mariusz Felisiak
2022-11-21Fixed #31090 -- Logged transaction management queries.Ilya Bass
Thanks to Petter Strandmark for the original idea and Mariusz Felisiak for advice during the DjangoConUS 2022 Sprint!
2022-10-03Fixed #23353 -- Used "raise from" when raising TransactionManagementError.David Wobrock
This change sets the __cause__ attribute to raised exceptions.
2022-09-06Refs #33616 -- Updated BaseDatabaseWrapper.run_on_commit comment.DevilsAutumn
2022-09-06Fixed #33616 -- Allowed registering callbacks that can fail in ↵SirAbhi13
transaction.on_commit(). Thanks David Wobrock and Mariusz Felisiak for reviews.
2022-03-24Refs #32365 -- Removed internal uses of utils.timezone.utc alias.Carlton Gibson
Remaining test case ensures that uses of the alias are mapped canonically by the migration writer.
2022-02-18Fixed #33379 -- Added minimum database version checks.Hasan Ramezani
Thanks Tim Graham for the review.
2022-02-07Refs #33476 -- Refactored code to strictly match 88 characters line length.Mariusz Felisiak
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2021-12-01Fixed #30398 -- Added CONN_HEALTH_CHECKS database setting.Przemysław Suliga
The CONN_HEALTH_CHECKS setting can be used to enable database connection health checks for Django's persistent DB connections. Thanks Florian Apolloner for reviews.
2021-11-19Refs #24121 -- Added __repr__() to BaseDatabaseWrapper, JoinPromoter, and ↵Jonny Park
SQLCompiler.
2021-11-12Fixed #33161 -- Enabled durability check for nested atomic blocks in TestCase.Krzysztof Jagiello
Co-Authored-By: Adam Johnson <me@adamj.eu>
2021-09-16Fixed #32365 -- Made zoneinfo the default timezone implementation.Carlton Gibson
Thanks to Adam Johnson, Aymeric Augustin, David Smith, Mariusz Felisiak, Nick Pope, and Paul Ganssle for reviews.
2020-10-19Fixed #32108 -- Made transaction.on_commit() raise TypeError when callback ↵Herbert Poul
is not a callable.
2020-07-30Bumped minimum isort version to 5.1.0.David Smith
Fixed inner imports per isort 5. isort 5.0.0 to 5.1.0 was unstable.
2020-02-06Refs #31233 -- Changed DatabaseWrapper._nodb_connection to _nodb_cursor().Jon Dufresne
It is now a method instead of a property and returns a context manager that yields a cursor on entry and closes the cursor and connection upon exit.
2020-02-04Simplified imports from django.db and django.contrib.gis.db.Nick Pope
2019-12-04Fixed #23524 -- Allowed DATABASES['TIME_ZONE'] option on PostgreSQL.Aymeric Augustin
2019-12-04Refs #23524 -- Unified BaseDatabaseWrapper.timezone.Aymeric Augustin
There was a special case in this property to return None when the database backend supports time zone. However, only the PostgreSQL backend supports time zones and it never uses this property.
2019-07-02Fixed typos in comments and docs.Min ho Kim
2019-06-20Fixed #30451 -- Added ASGI handler and coroutine-safety.Andrew Godwin
This adds an ASGI handler, asgi.py file for the default project layout, a few async utilities and adds async-safety to many parts of Django.
2019-05-08Used time.monotonic() instead of time.time() where applicable.Przemysław Suliga
time.monotonic() available from Python 3.3: - Nicely communicates a narrow intent of "get a local system monotonic clock time" instead of possible "get a not necessarily accurate Unix time stamp because it needs to be communicated to outside of this process/machine" when time.time() is used. - Its result isn't affected by the system clock updates. There are two classes of time.time() uses changed to time.monotonic() by this change: - measuring time taken to run some code. - setting and checking a "close_at" threshold for for persistent db connections (django/db/backends/base/base.py).
2019-02-14Fixed #30171 -- Fixed DatabaseError in servers tests.Jon Dufresne
Made DatabaseWrapper thread sharing logic reentrant. Used a reference counting like scheme to allow nested uses. The error appeared after 8c775391b78b2a4a2b57c5e89ed4888f36aada4b.
2018-10-25Refs #27025 -- Removed obsolete sqlite3 transaction management workaround ↵Tim Graham
for Python 3.6+. Obsolete per https://bugs.python.org/issue10740#msg274816.
2018-02-26Refs #28909 -- Simplifed code using unpacking generalizations.Mariusz Felisiak
2017-11-28Fixed #28853 -- Updated connection.cursor() uses to use a context manager.Jon Dufresne
2017-09-21Refs #28595 -- Added a hook to add execute wrappers for database queries.Shai Berger
Thanks Adam Johnson, Carl Meyer, Anssi Kääriäinen, Mariusz Felisiak, Michael Manfre, and Tim Graham for discussion and review.
2017-05-23Refs #27859 -- Added DatabaseWrapper.display_name.Mariusz Felisiak
Thanks Tim Graham for the review.
2017-02-28Refs #27656 -- Updated django.db docstring verbs according to PEP 257.Anton Samarchyan
2017-01-19Refs #23919 -- Stopped inheriting from object to define new style classes.Simon Charette
2017-01-18Refs #23919 -- Removed most of remaining six usageClaude Paroz
Thanks Tim Graham for the review.
2017-01-16Refs #16614 -- Called _prepare_cursor() on every created cursor.François Freitag
2017-01-11Refs #16614 -- Made QuerySet.iterator() use server-side cursors on PostgreSQL.François Freitag
Thanks to Josh Smeaton for the idea of implementing server-side cursors in PostgreSQL from the iterator method, and Anssi Kääriäinen and Kevin Turner for their previous work. Also Simon Charette and Tim Graham for review.
2016-11-23Fixed #27504 -- Allowed using the ORM after an error and rollback when ↵Mark Young
autocommit is off.
2016-10-27Fixed #27327 -- Simplified time zone handling by requiring pytz.Tim Graham
2016-09-08Fixed #27170 -- Added DatabaseWrapper class attributes to ease subclassing.Chris Jerdonek
2016-06-06Fixed #26712 -- Avoided unnecessary SET TIMEZONE queries on PostgreSQL.Simon Charette
A change of the USE_TZ or TIME_ZONE settings doesn't necessarily require a change to the active connections' timezones.
2016-05-18Fixed #26627 -- Fixed on_commit callbacks execution order when callbacks ↵Barthelemy Dagenais
make transactions.
2016-04-04Fixed W503 flake8 warnings.Tim Graham
2015-09-11Fixed #25329 -- Prevented _nodb_connection from being left openAdam Chainz
2015-09-09Changed database connection duplication technique.Aymeric Augustin
This new technique is more straightforward and compatible with test parallelization, where the effective database connection settings no longer match settings.DATABASES.
2015-06-30Fixed #21803 -- Added support for post-commit callbacksAndreas Pelme
Made it possible to register and run callbacks after a database transaction is committed with the `transaction.on_commit()` function. This patch is heavily based on Carl Meyers django-transaction-hooks <https://django-transaction-hooks.readthedocs.org/>. Thanks to Aymeric Augustin, Carl Meyer, and Tim Graham for review and feedback.
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.