[Django] #36675: Oracle dialect depends on implementation detail which was changed in python-oracledb 3.4

2 views
Skip to first unread message

Django

unread,
Oct 21, 2025, 12:13:57 AM (yesterday) Oct 21
to django-...@googlegroups.com
#36675: Oracle dialect depends on implementation detail which was changed in
python-oracledb 3.4
-------------------------------------+-------------------------------------
Reporter: Anthony Tuininga | Type: Bug
Status: new | Component: Database
| layer (models, ORM)
Version: 5.2 | Severity: Normal
Keywords: oracle | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
This issue was reported by a Django user with the upgrade to python-
oracledb 3.4: https://github.com/oracle/python-oracledb/issues/544. The
issue is that the Django Oracle dialect depended on an implementation
detail which changed in python-oracledb 3.4.

The following patch addresses that and is fine for all supported versions
of cx_Oracle and python-oracledb:

{{{
diff --git a/django/db/backends/oracle/base.py
b/django/db/backends/oracle/base.py
index 3b37c38f97..71089c1166 100644
--- a/django/db/backends/oracle/base.py
+++ b/django/db/backends/oracle/base.py
@@ -438,7 +438,7 @@ class OracleParam:
param = 0
if hasattr(param, "bind_parameter"):
self.force_bytes = param.bind_parameter(cursor)
- elif isinstance(param, (Database.Binary, datetime.timedelta)):
+ elif isinstance(param, (bytes, datetime.timedelta)):
self.force_bytes = param
else:
# To transmit to the database, we need Unicode if supported
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36675>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 21, 2025, 12:22:49 AM (yesterday) Oct 21
to django-...@googlegroups.com
#36675: Oracle dialect depends on implementation detail which was changed in
python-oracledb 3.4
-------------------------------------+-------------------------------------
Reporter: Anthony Tuininga | Owner: (none)
Type: Bug | Status: new
Component: Database layer | Version: 5.2
(models, ORM) |
Severity: Normal | Resolution:
Keywords: oracle | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Anthony Tuininga):

A more comprehensive patch (also safe for all supported versions of
cx_Oracle and python-oracledb):

{{{
diff --git a/django/db/backends/oracle/base.py
b/django/db/backends/oracle/base.py
index 3b37c38f97..71089c1166 100644
--- a/django/db/backends/oracle/base.py
+++ b/django/db/backends/oracle/base.py
@@ -438,7 +438,7 @@ class OracleParam:
param = 0
if hasattr(param, "bind_parameter"):
self.force_bytes = param.bind_parameter(cursor)
- elif isinstance(param, (Database.Binary, datetime.timedelta)):
+ elif isinstance(param, (bytes, datetime.timedelta)):
self.force_bytes = param
else:
# To transmit to the database, we need Unicode if supported
diff --git a/django/db/backends/oracle/operations.py
b/django/db/backends/oracle/operations.py
index 59eecdba20..14c69a59ff 100644
--- a/django/db/backends/oracle/operations.py
+++ b/django/db/backends/oracle/operations.py
@@ -273,12 +273,12 @@ END;
return value

def convert_datefield_value(self, value, expression, connection):
- if isinstance(value, Database.Timestamp):
+ if isinstance(value, datetime.datetime):
value = value.date()
return value

def convert_timefield_value(self, value, expression, connection):
- if isinstance(value, Database.Timestamp):
+ if isinstance(value, datetime.datetime):
value = value.time()
return value

diff --git a/django/db/backends/oracle/utils.py
b/django/db/backends/oracle/utils.py
index 57d97b3f77..d69414240c 100644
--- a/django/db/backends/oracle/utils.py
+++ b/django/db/backends/oracle/utils.py
@@ -24,7 +24,7 @@ class InsertVar:
"BooleanField": int,
"FloatField": Database.DB_TYPE_BINARY_DOUBLE,
"DateTimeField": Database.DB_TYPE_TIMESTAMP,
- "DateField": Database.Date,
+ "DateField": datetime.date,
"DecimalField": decimal.Decimal,
}
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36675#comment:1>

Django

unread,
Oct 21, 2025, 4:29:11 AM (yesterday) Oct 21
to django-...@googlegroups.com
#36675: Oracle dialect depends on implementation detail which was changed in
python-oracledb 3.4
-------------------------------------+-------------------------------------
Reporter: Anthony Tuininga | Owner:
| varunkasyap
Type: Bug | Status: assigned
Component: Database layer | Version: 5.2
(models, ORM) |
Severity: Normal | Resolution:
Keywords: oracle | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by varunkasyap):

* owner: (none) => varunkasyap
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/36675#comment:2>

Django

unread,
Oct 21, 2025, 7:26:54 AM (yesterday) Oct 21
to django-...@googlegroups.com
#36675: Oracle dialect depends on implementation detail which was changed in
python-oracledb 3.4
-------------------------------------+-------------------------------------
Reporter: Anthony Tuininga | Owner: Varun
| Kasyap Pentamaraju
Type: Bug | Status: assigned
Component: Database layer | Version: 5.2
(models, ORM) |
Severity: Normal | Resolution:
Keywords: oracle | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Varun Kasyap Pentamaraju):

I've examined the code in the stable/5.2.x branch and found that all three
changes mentioned in the ticket are already implemented:

1. In django/db/backends/oracle/base.py: Already using `bytes` instead of
`Database.Binary`
2. In django/db/backends/oracle/operations.py: Already using
`datetime.datetime` instead of `Database.Timestamp`
3. In django/db/backends/oracle/utils.py: Already using `datetime.date`
instead of `Database.Date`

Could you please advise if there are other aspects of this ticket that
still need to be addressed, or if it can be closed as already fixed?
--
Ticket URL: <https://code.djangoproject.com/ticket/36675#comment:3>

Django

unread,
Oct 21, 2025, 8:18:24 AM (23 hours ago) Oct 21
to django-...@googlegroups.com
#36675: Oracle dialect depends on implementation detail which was changed in
python-oracledb 3.4
-------------------------------------+-------------------------------------
Reporter: Anthony Tuininga | Owner: Varun
| Kasyap Pentamaraju
Type: Bug | Status: closed
Component: Database layer | Version: 5.2
(models, ORM) |
Severity: Normal | Resolution: duplicate
Keywords: oracle | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* resolution: => duplicate
* status: assigned => closed

Comment:

We don't intend to fix this in Django 5.1 or 4.2, both versions already
document lack of support for `oracledb` >= 3.4.0. Duplicate of #36646.
--
Ticket URL: <https://code.djangoproject.com/ticket/36675#comment:4>

Django

unread,
Oct 21, 2025, 8:20:25 AM (23 hours ago) Oct 21
to django-...@googlegroups.com
#36675: Oracle dialect depends on implementation detail which was changed in
python-oracledb 3.4
-------------------------------------+-------------------------------------
Reporter: Anthony Tuininga | Owner: Varun
| Kasyap Pentamaraju
Type: Bug | Status: closed
Component: Database layer | Version: 5.2
(models, ORM) |
Severity: Normal | Resolution: duplicate
Keywords: oracle | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Natalia Bidart):

Hello, thank you for your ticket report! This is a dupe of #36646 which is
already fixed and will be released with the next 5.2.8 release.
--
Ticket URL: <https://code.djangoproject.com/ticket/36675#comment:5>
Reply all
Reply to author
Forward
0 new messages