Opened 12 years ago
Closed 12 years ago
#18843 closed Bug (fixed)
manage.py inspectdb raises TypeError for columns containing '%'
Reported by: | Andy Terra | Owned by: | nobody |
---|---|---|---|
Component: | Core (Management commands) | Version: | 1.4 |
Severity: | Normal | Keywords: | inspectdb, TypeError |
Cc: | shai@… | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
python manage.py inspectdb --database=foo
class Foobar(models.Model):
TypeError: not enough arguments for format string
I've since inspected the database and spotted fields such as...
"PARTIC _(%)_PRÉ"
"Participação_de_Recarga_no_GROSS_(%)"
...which I believe are causing this error.
Change History (9)
comment:1 by , 12 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 by , 12 years ago
I'm not absolutely sure to have fixed your precise problem. At least, the non-ascii chars stuff is the subject of ticket #16737.
comment:4 by , 12 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
This breaks tests on Oracle. Oracle fails to handle the '%' char in table creation at base.py:700. One possible fix here https://github.com/akaariai/django/tree/ticket_18843_fix
This is a quick & dirty fix. There might be some deeper problem in the Oracle backend's handling of table creation query strings, but I am too tired to begin inspecting that possibility.
comment:5 by , 12 years ago
Is there any other special character in Oracle that is accepted in a table name but would be replaced by re.subn(r'\W', '_', new_name)?
comment:6 by , 12 years ago
Easy pickings: | unset |
---|
Due to the requirement to test this against multiple databases (one being Oracle) and the fact that an existing patch exists, I'm removing easy_pickings from this one. Please revert if you don't agree.
comment:7 by , 12 years ago
Cc: | added |
---|
I believe the fix for this problem has already been committed, to master before 1.5 was branched, by @akaariai.
comment:8 by , 12 years ago
Anssi recently confirmed that the test suite passes on Oracle (+ Python 3, but that doesn't matter here). So it's probably fixed indeed.
comment:9 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
I plan to commit first #12460, then it should be easier to fix this one.