Opened 8 years ago
Closed 7 years ago
#27533 closed Bug (fixed)
inspectdb crashes on unsupported unique_together constraints in PostgreSQL
Reported by: | Wei Ma | Owned by: | Michael Sinov |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.10 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
inspectdb command crashes when I try to generate model classes from postgres db.
the command I used was
python manage.py inspectdb > all_models.py
the error I got was:
File "/xxx/env/lib/python3.5/site-packages/django/core/management/commands/inspectdb.py", line 278, in <genexpr>
tup = '(' + ', '.join("'%s'" % column_to_field_name[c] for c in columns) + ')'
KeyError: None
Change History (8)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Adding "Needs Tests" flag per PR Commenthttps://github.com/django/django/pull/7618#issuecomment-263023058
comment:3 by , 8 years ago
Component: | Core (Other) → Database layer (models, ORM) |
---|---|
Needs tests: | set |
Summary: | inspectdb command crashes when generate model classes from postgres db → inspectdb crashes on unsupported unique_together constraints in PostgreSQL |
Triage Stage: | Unreviewed → Accepted |
comment:4 by , 8 years ago
I have closed my PR https://github.com/django/django/pull/7618 due to not able to create test cases. If anyone want to help, please fork my repo and add needed tests.
comment:6 by , 8 years ago
Has patch: | unset |
---|---|
Patch needs improvement: | set |
comment:7 by , 8 years ago
Has patch: | set |
---|
I created a PR https://github.com/django/django/pull/7618 for this bug.