Joanna
Joanna

Reputation: 61

Django inspectdb for Oracle

I am doing a project and need retrieve tables/models from a Oracle database(version 19c). So I am trying to use Django ‘inspectdb’ to do this.

– my settings.py looks like:

import cx_Oracle
cx_Oracle.init_oracle_client(lib_dir=“/opt/oracle/instantclient_21_7”)

DATABASES = {
‘default’: {
‘ENGINE’: ‘django.db.backends.oracle’,
‘NAME’: ‘service name’,
‘USER’: ‘XXX’,
‘PASSWORD’: ‘XXX’,
‘HOST’: ‘’,
‘PORT’: ‘’,
‘OPTIONS’: {
‘threaded’: True,
‘use_returning_into’: False,

 },
}
}

– Running these followings in shell are all good:

import cx_Oracle

dsn_tns = cx_Oracle.makedsn(‘Host Name’, ‘Port Number’, service_name=‘Service Name’)
conn = cx_Oracle.connect(user=‘User Name’, password=‘Personal Password’, dsn=dsn_tns)
c = conn.cursor()
c.execute(‘select * from schema.table’)

for row in c:
print (row)

Issues: But when I try using : python3 manage.py inspectdb schema.table

It returns error : "The error was: ORA-00942: table or view does not exist "

Could anyone help me? thanks alot!

Upvotes: 1

Views: 108

Answers (0)

Related Questions