summaryrefslogtreecommitdiff
path: root/django/db/backends/utils.py
AgeCommit message (Collapse)Author
2024-02-15Fixed #33037 -- Fixed Trunc() with offset timezones on MySQL, SQLite, Oracle.Shafiya Adzhani
2023-09-25Fixed #34849 -- Avoided raising RuntimeWarning about import-time queries ↵David Sanders
when apps are reinitialized with test tools. Regression in fbd16438f46bc2128926958ad24331da5d1b406f.
2023-08-21Fixed #33143 -- Raised RuntimeWarning when performing import-time queries.Florian Zimmermann
2023-08-10Fixed #33817 -- Added support for python-oracledb and deprecated cx_Oracle.Jingbei Li
2023-02-01Refs #33476 -- Applied Black's 2023 stable style.David Smith
Black 23.1.0 is released which, as the first release of the year, introduces the 2023 stable style. This incorporates most of last year's preview style. https://github.com/psf/black/releases/tag/23.1.0
2023-01-18Fixed #34233 -- Dropped support for Python 3.8 and 3.9.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-02-07Refs #33476 -- Reformatted code with Black.django-bot
2021-11-12Fixed #33279 -- Fixed handling time zones with "-" sign in names.Can Sarigol
Thanks yakimka for the report. Regression in fde9b7d35e4e185903cc14aa587ca870037941b1.
2021-10-12Fixed #28401 -- Allowed hashlib.md5() calls to work with FIPS kernels.Ade Lee
md5 is not an approved algorithm in FIPS mode, and trying to instantiate a hashlib.md5() will fail when the system is running in FIPS mode. md5 is allowed when in a non-security context. There is a plan to add a keyword parameter (usedforsecurity) to hashlib.md5() to annotate whether or not the instance is being used in a security context. In the case where it is not, the instantiation of md5 will be allowed. See https://bugs.python.org/issue9216 for more details. Some downstream python versions already support this parameter. To support these versions, a new encapsulation of md5() has been added. This encapsulation will pass through the usedforsecurity parameter in the case where the parameter is supported, and strip it if it is not. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-07-02Fixed #30934 -- Included database alias in django.db.backends log messages.Nick Pope
This is useful when working with database routing as you want to know where each query is being executed. Co-authored-by: David Winterbottom <david.winterbottom@gmail.com>
2020-05-06Fixed a/an typos in "SQL" usage.Adam Johnson
2020-02-04Simplified imports from django.db and django.contrib.gis.db.Nick Pope
2019-12-11Refs #28373 -- Stopped setting tzinfo in typecast_timestamp().Sergey Fedoseev
Unnecessary since cef3f2d3c64055c9fc1757fd61dba24b557a2add. When USE_TZ=True, conn_tznames is always passed to methods that use typecast_timestamp(). Therefore, it can return naive datetimes.
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-05-07Readded comment about the default params of cursor.execute().Daniel Hahler
It was removed in in 728548e483a5a3486939b0c8e62520296587482e.
2019-04-29Refs #30148 -- Moved logging queries in CursorDebugWrapper to debug_sql() ↵kingbuzzman
contextmanager.
2018-11-09Removed unused 'tz' variable in typecast_timestamp().Srinivas Reddy Thatiparthy
2018-10-02Added django.db.backends.utils.names_digest() to remove redundant code.Jon Dufresne
2018-09-25Refs #27795 -- Removed force_bytes() usage in db/backends/utils.py.Jon Dufresne
2018-07-02Removed unused code in django.db.backends.utils.format_number().Tim Graham
2018-07-02Simplified SQLite's Decimal adapter.Sergey Fedoseev
2017-12-30Used Decimal.scaleb() in backends.utils.format_number() and ↵Mariusz Felisiak
DecimalField.widget_attrs() to improve performance.
2017-11-14Fixed #28792 -- Fixed index name truncation of namespaced tables.Simon Charette
Refs #27458, #27843. Thanks Tim and Mariusz for the review.
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-08-12Fixed #23546 -- Added kwargs support for CursorWrapper.callproc() on Oracle.Mariusz Felisiak
Thanks Shai Berger, Tim Graham and Aymeric Augustin for reviews and Renbi Yu for the initial patch.
2017-08-11Replaced typecast_decimal() with decimal.Decimal().Sergey Fedoseev
2017-08-09Refs #4518 -- Removed handling of empty strings in typecast_decimal().Sergey Fedoseev
It's unclear if the original change was needed, but it seems unneeded now. Reverted 6fc10f50b0c9b877fffcad4893056cb91fa66b4f.
2017-02-28Refs #27656 -- Updated django.db docstring verbs according to PEP 257.Anton Samarchyan
2017-02-27Refs #27843 -- Fixed 'invalid escape sequence' warning in truncate_name().Tim Graham
2017-02-23Refs #23919 -- Used yield from.Vytis Banaitis
2017-02-17Fixed #27843 -- Fixed truncate_name() when the name contains a username.Mariusz Felisiak
2017-01-25Refs #23919 -- Replaced super(ClassName, self) with super().chillaranand
2017-01-19Fixed spelling mistakes in code and comments.james mike dupont
2017-01-19Refs #23919 -- Stopped inheriting from object to define new style classes.Simon Charette
2017-01-18Refs #23919 -- Removed encoding preambles and future importsClaude Paroz
2016-12-30Fixed #27458 -- Fixed invalid sequence/index names when using "USER"."TABLE" ↵Andrew Nester
db_table on Oracle.
2016-04-18Fixed #26498 -- Fixed TimeField microseconds round-tripping on MySQL and SQLite.Lukasz Wiecek
Thanks adamchainz for the report and review.
2016-04-08Fixed E128 flake8 warnings in django/.Tim Graham
2015-12-26Passed logging message parameters as arguments instead of interpolating them.Ville Skyttä
2015-02-06Sorted imports with isort; refs #23860.Tim Graham
2014-12-12Fixed #23941 -- Removed implicit decimal formatting from expressions.Josh Smeaton
2014-10-27Fixed #22879 -- Intercept errors coming from cursor.__next__()Mikhail Denisenko
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-04-24Prevented a crash in the cursor wrappers on Oracle.Aymeric Augustin
Fixed #22483 (again). Forwardport of 5cd6429620 from stable/1.7.x
2014-03-30Corrected many style guide violations that the newest version of flake8 catchesAlex Gaynor
2014-03-21Removed legacy transaction management per the deprecation timeline.Aymeric Augustin
2013-11-02Fixed all E261 warningscoagulant
2013-09-30Fixed #21134 -- Prevented queries in broken transactions.Aymeric Augustin
Squashed commit of the following: commit 63ddb271a44df389b2c302e421fc17b7f0529755 Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sun Sep 29 22:51:00 2013 +0200 Clarified interactions between atomic and exceptions. commit 2899ec299228217c876ba3aa4024e523a41c8504 Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sun Sep 22 22:45:32 2013 +0200 Fixed TransactionManagementError in tests. Previous commit introduced an additional check to prevent running queries in transactions that will be rolled back, which triggered a few failures in the tests. In practice using transaction.atomic instead of the low-level savepoint APIs was enough to fix the problems. commit 4a639b059ea80aeb78f7f160a7d4b9f609b9c238 Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Tue Sep 24 22:24:17 2013 +0200 Allowed nesting constraint_checks_disabled inside atomic. Since MySQL handles transactions loosely, this isn't a problem. commit 2a4ab1cb6e83391ff7e25d08479e230ca564bfef Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sat Sep 21 18:43:12 2013 +0200 Prevented running queries in transactions that will be rolled back. This avoids a counter-intuitive behavior in an edge case on databases with non-atomic transaction semantics. It prevents using savepoint_rollback() inside an atomic block without calling set_rollback(False) first, which is backwards-incompatible in tests. Refs #21134. commit 8e3db393853c7ac64a445b66e57f3620a3fde7b0 Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sun Sep 22 22:14:17 2013 +0200 Replaced manual savepoints by atomic blocks. This ensures the rollback flag is handled consistently in internal APIs.
2013-09-25Fixed #17671 - Cursors are now context managers.Michael Manfre