Opened 3 years ago

Closed 3 years ago

#33643 closed Bug (fixed)

inspectdb crashes on Oracle databases with functional indexes.

Reported by: Scott Owned by: Scott
Component: Core (Management commands) Version: 4.0
Severity: Normal Keywords: oracle inspectdb
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I'm getting the following error when using inspectdb with an Oracle database. The column in question is a hidden column that's automatically created by the database, and doesn't need a model. The command runs fine if I add something to skip these columns. Here's a related issue in SQLAlchemy: https://github.com/sqlalchemy/sqlalchemy/issues/1513

Traceback (most recent call last):
  File "xxxx\envs\django\Scripts\manage.py-script.py", line 33, in <module>
    sys.exit(load_entry_point('hero', 'console_scripts', 'manage.py')())
  File "xxxx\__init__.py", line 17, in manage
    execute_from_command_line(sys.argv)
  File "xxxx\envs\django\lib\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_line    utility.execute()
  File "xxxx\envs\django\lib\site-packages\django\core\management\__init__.py", line 440, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "xxxx\envs\django\lib\site-packages\django\core\management\base.py", line 414, in run_from_argv
    self.execute(*args, **cmd_options)
  File "xxxx\envs\django\lib\site-packages\django\core\management\base.py", line 460, in execute
    output = self.handle(*args, **options)
  File "xxxx\envs\django\lib\site-packages\django\core\management\commands\inspectdb.py", line 46, in handle
    for line in self.handle_inspection(options):
  File "xxxx\envs\django\lib\site-packages\django\core\management\commands\inspectdb.py", line 226, in handle_inspection
    yield from self.get_meta(
  File "xxxx\envs\django\lib\site-packages\django\core\management\commands\inspectdb.py", line 348, in get_meta       
    str(tuple(column_to_field_name[c] for c in columns))
  File "xxxx\envs\django\lib\site-packages\django\core\management\commands\inspectdb.py", line 348, in <genexpr>      
    str(tuple(column_to_field_name[c] for c in columns))
KeyError: 'sys_nc00106$'

Change History (8)

comment:1 by Mariusz Felisiak, 3 years ago

Keywords: oracle inspectdb added
Summary: KeyError when running manage.py inspectdb against an Oracle database.inspectdb crashes on Oracle databases with functional indexes.
Triage Stage: UnreviewedAccepted

I'm aware there are hidden/internal columns on Oracle, so it seems valid. Would you like to provide a patch?

in reply to:  1 comment:2 by Scott, 3 years ago

Replying to Mariusz Felisiak:

I'm aware there are hidden/internal columns on Oracle, so it seems valid. Would you like to provide a patch?

I can make a patch.

comment:3 by Scott, 3 years ago

Owner: changed from nobody to Scott
Status: newassigned

comment:4 by Scott, 3 years ago

Has patch: set
Version 0, edited 3 years ago by Scott (next)

comment:5 by Mariusz Felisiak, 3 years ago

Triage Stage: AcceptedReady for checkin

comment:6 by Mariusz Felisiak, 3 years ago

Patch needs improvement: set
Triage Stage: Ready for checkinAccepted

comment:7 by Mariusz Felisiak, 3 years ago

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:8 by GitHub <noreply@…>, 3 years ago

Resolution: fixed
Status: assignedclosed

In e1267001:

Fixed #33643 -- Fixed inspectdb crash on functional unique constraints on Oracle.

Note: See TracTickets for help on using tickets.
Back to Top