Django inspectdb ORA-00942: table or view does not exist

Im trying to import existing oracle tables in django. Installed cx_oracle and i did all the steps for django to communicate with my oracle db.

import cx_Oracle

con = cx_Oracle.connect("PYTHON","PYTHON", "METDBR")

cur = con.cursor()
cur.execute("select * from ICUSTOMER")
res = cur.fetchall()
for row in res:
    print(row)

works fine…

when im trying to inspect the table with the command

python manage.py inspectdb icustomer

i get Unable to inspect table ‘icustomer’ The error was: ORA-00942: table or view does not exist

Can we see your settings.py file entry for DATABASES? (Looking to verify that it matches your .connect parameters) Also, what version of Oracle are you connecting to, and which version of cx_Oracle do you have installed? From the Oracle notes:

Django supports Oracle Database Server versions 12.2 and higher. Version 6.0 or higher of the cx_Oracle Python driver is required.

1 Like

Thank you so much for the answer.
My Db is Oracle Database 12c Release 12.1.0.1.0 - 64bit Production

So it seems its not working with my version.Right?

I don’t have any Oracle instances available to me to check. It’s not always a case that an old release isn’t going to work, only that it’s not “supported”. (What that generally means for something like this is that the developers aren’t going to fix any problems that appear with unsupported versions.)

But yes, it’s possible that there was some API change between 12.1 and 12.2 that would prevent inspectdb from working on a 12.1 server. Typically, I’d look for whatever documents the differences between 12.1 and 12.2 to see if there’s anything that changed that might be a cause. But I’d also look for things under my control, such as configuration issues.

1 Like

Thank you so much sir.
Tested it on 19.0.0.0 database and it works as expected.