DRF issue while attempting to inspectdb command error appears: # The error was: ORA-00904: "USER_TABLES"."DEFAULT_COLLATION": invalid identifier

I have an Oracle database version 11.5.10.2. Recently, I study DjangoRestFramework in order to perform own APIs.

Firstly, command python manage.py runserver doesn't work due to unable to connect to database. Then I imported oracledb module to settings.py file and added following command:

oracledb.init_oracle_client(lib_dir=r'C:\\oracle\\instantclient_23_6')

Without client no any connection appears for Oracle database. After that command 'python manage.py runserver' does connect to Oracle DB without errors. Since I don't need to do any changes in database due to many finance records I would upload models structure for my necessary tables only for API use GET HTTP method protocol. So, not at all tables are need to be inspected and moved to models.py file.

Thus, for testing I add following command im command prompt: 'python manage.py inspectdb ap.ap_invoices_all' and output text is following:

# This is an auto-generated Django model module.

# You'll have to do the following manually to clean this up:

# \* Rearrange models' order

# \* Make sure each model has one field with primary_key=True

# \* Make sure each ForeignKey and OneToOneField has `on_delete` set to the desired behavior

# \* Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table

# Feel free to rename the models, but don't rename db_table values or field names.

from django.db import models

# Unable to inspect table 'ap.ap_invoices_all'

# The error was: ORA-00904: "USER_TABLES"."DEFAULT_COLLATION": invalid identifier

Help: https://docs.oracle.com/error-help/db/ora-00904/%60

Does anyone know a reason? Does anyone know if there have been any changes to make Django work with Oracle 11?

I tried to upload structure of Oracle table ap.ap_invoices_all for models.py file. I expected to see a model in models.py file.

Вернуться на верх