#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>