Opened 14 years ago

Closed 14 years ago

#2517 closed enhancement (fixed)

[patch] add handling of column names with spaces to inspectdb

Reported by: Karen Tracey <graybark@…> Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version:
Severity: minor Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


inspectdb does not currently notice when a database table contains a column with embedded spaces in the name. Translating such a name directly to a field name causes a syntax error since a field name cannot contain spaces. I've got a patch that fixes this by simply removing the spaces in the generated name. db_column is set just as it is for DB column names that duplicate Python reserved words.

Attachments (1)

management.diff (730 bytes) - added by Karen Tracey <graybark@…> 14 years ago.

Download all attachments as: .zip

Change History (3)

Changed 14 years ago by Karen Tracey <graybark@…>

Attachment: management.diff added

comment:1 Changed 14 years ago by Karen Tracey <graybark@…>

Forgot to mention I tested this patch against my own DB which has tables where some of the column names contain spaces. It seems to work properly.

comment:2 Changed 14 years ago by Adrian Holovaty

Resolution: fixed
Status: newclosed

(In [3549]) Fixed #2517 -- Improved inspectdb to handle table column names that contain spaces. Thanks, Karen Tracey

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