1

I have an existing database in Oracle 11.2.

I am trying to use inspectdb utility of django to automatically create the models but I am getting the error:

ORA-00904: "IDENTITY_COLUMN": invalid identifier

There is no column named IDENTITY_COLUMN in any of the tables and since I am not directly accessing the database, the chances of misspelling a column name or accessing a wrong column is not possible.

It would be very helpful if someone can give a direction as to what to fix to solve this error.

Ralf
  • 16,086
  • 4
  • 44
  • 68
KChow
  • 317
  • 3
  • 15

3 Answers3

2

I had a similar problem also working with Oracle 11.2

I downgraded Django===2.1 to Django===1.11.13 temporarily to run inspectdb as a work around since my legacy models needed to be manually cleaned up anyway, but it was a good place to start for reverse engineering models from a legacy db.

J. Lewis
  • 33
  • 9
2

Same thing happened to me . First downgrade your django into a lower version (1.11.22) and run

python manage.py inspectdb > your_app_name/models.py

Then upgrade to whatever version you are using . I was using 3.0.4

Zarif
  • 445
  • 5
  • 12
1

I'm not sure if it is possible.

The docs don't mention Oracle:

inspectdb works with PostgreSQL, MySQL and SQLite.

But a user said they got it working, for example this comment in a previous question. See also this older question for some hints.

Ralf
  • 16,086
  • 4
  • 44
  • 68
  • https://docs.djangoproject.com/en/2.2/ref/django-admin/#django-admin-inspectdb explicitly mentions how oracle db behaves, so probably this is supported. But I realized that django 2.2 doesn't support Oracle DB version 11. That can be the issue – Michel Samia Oct 11 '19 at 14:46