Opened 18 years ago
Closed 18 years ago
#4431 closed (fixed)
manage.py loaddata should have better error reporting
| Reported by: | Owned by: | David A Krauth | |
|---|---|---|---|
| Component: | Tools | Version: | dev |
| Severity: | Keywords: | manage.py loaddata dumpdata | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
When dumping database with
python manage.py --format=xml dumpdata > dump.xml
I'd like to migrate to another one and load data back. However, I perhaps have some inconsistency, so I got
python manage.py loaddata dump.xml Loading 'dump' fixtures... Installing xml fixture 'dump' from absolute path. Problem installing fixture 'dump.xml': WikiObject matching query does not exist.
I have to fix it manually, however I have no idea which query failed and with FK I have to fix (or obect to delete etc.) (and yes, I have no idea when this inconsistency started).
loaddata should display on which object this query failed.
Attachments (1)
Change History (10)
comment:1 by , 18 years ago
| Triage Stage: | Unreviewed → Design decision needed |
|---|
comment:2 by , 18 years ago
| Triage Stage: | Design decision needed → Accepted |
|---|
comment:3 by , 18 years ago
FYI - the underlying cause of this problem is described in ticket #4459. However, you are correct - the error reporting should be improved.
comment:4 by , 18 years ago
| Owner: | changed from to |
|---|
comment:5 by , 18 years ago
| Keywords: | dumpdata added |
|---|
The same problem occured when using dumpdata, if the database is inconsistent (differences between the models and the schema).
For example, consider a class A with a FK to class B. If the FK is removed from the database, and rows in table_A refers to id which are not in table_B, dumpdata will fail with a "B matching query does not exist."
This is not a bug in dumpdata, but if it reported errors more accurately, it might be easier to debug.
comment:6 by , 18 years ago
| Owner: | changed from to |
|---|
by , 18 years ago
comment:7 by , 18 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
Added --traceback option at a the topmost Command level. Where appropriate, exceptions should be allowed to propagate. End users can then run pdb to inspect the exception stack frame.
comment:9 by , 18 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
A good way to handle this would be to add a
--tracebackoption tomanage.pywhich would dump the traceback if something fails. This would be consistent with the way some other tools written in Python do things (bzr, hg, others).