#33817: Use python-oracledb instead of cx-oracle
-------------------------------------+-------------------------------------
Reporter: Alexander Shishenko | Owner: Jingbei
| Li
Type: New feature | Status: closed
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: oracle | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Jingbei Li):
@Peter If you are not afraid of breaking things, you can check some
earlier commit of that PR.
For example, the very first commit can just be used as a dirty workaround.
{{{
From 0ee2e12252c0eb8b735ad99bb834d4122847f246 Mon Sep 17 00:00:00 2001
From: Jingbei Li <[email protected]>
Date: Tue, 12 Jul 2022 14:22:40 +0800
Subject: [PATCH] added oracledb support
---
django/db/backends/oracle/base.py | 7 +++++--
django/db/backends/oracle/introspection.py | 5 ++++-
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/django/db/backends/oracle/base.py
b/django/db/backends/oracle/base.py
index 2ccd3bc0286da..a38bf0421c669 100644
--- a/django/db/backends/oracle/base.py
+++ b/django/db/backends/oracle/base.py
@@ -49,9 +49,12 @@ def _setup_environment(environ):
try:
- import cx_Oracle as Database
+ import oracledb as Database
except ImportError as e:
- raise ImproperlyConfigured("Error loading cx_Oracle module: %s" % e)
+ try:
+ import cx_Oracle as Database
+ except ImportError as e:
+ raise ImproperlyConfigured("Error loading oracledb or cx_Oracle
module: %s" % e)
# Some of these import cx_Oracle, so import them after checking if it's
installed.
from .client import DatabaseClient # NOQA
diff --git a/django/db/backends/oracle/introspection.py
b/django/db/backends/oracle/introspection.py
index ce743b291d74b..d4b10f0afab65 100644
--- a/django/db/backends/oracle/introspection.py
+++ b/django/db/backends/oracle/introspection.py
@@ -1,6 +1,9 @@
from collections import namedtuple
-import cx_Oracle
+try:
+ import oracledb as cx_Oracle
+except ImportError:
+ import cx_Oracle
from django.db import models
from django.db.backends.base.introspection import
BaseDatabaseIntrospection
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33817#comment:33>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018f630ad936-311a9a59-cbe9-43a7-8090-2a71f15a244e-000000%40eu-central-1.amazonses.com.