Opened 7 years ago

Closed 5 years ago

#11391 closed Bug (duplicate)

Legacy Database "%" escaping not documented

Reported by: Greg Owned by: nobody
Component: Core (Management commands) Version: 1.0
Severity: Normal Keywords: legacy, inspectdb
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


While creating a model for a legacy database using inspectdb, I was not able to retrieve data from a column where db_column referenced a field with a % i.e. Discount%. Eventually, through the help here I learned that it is necessary to escape the % with a %%, which makes sense overall, but was not obvious in the context of the model design.

The need to escape the % with %% is not documented as far as I can tell and should either be automatic with inspectdb or included in the Integrating Django with a legacy database documentation (I leaning towards the latter). Other such non-obvious (at least for relatively new python and django users) aspects of dealing with a legacy database should also be documented more clearly, perhaps in a Things To Look Out For section for example.

Thank you.

Change History (8)

comment:1 Changed 7 years ago by Greg

  • Keywords lecacy added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 7 years ago by Greg

  • Keywords legacy added; lecacy removed

comment:3 Changed 7 years ago by russellm

  • Triage Stage changed from Unreviewed to Accepted

comment:4 Changed 5 years ago by gabrielhurley

  • Component changed from inspectdb to Core (Management commands)

comment:5 Changed 5 years ago by julien

  • Severity set to Normal
  • Type set to Bug

See #6343 for a potentially related issue.

comment:6 Changed 5 years ago by julien

See some other issues relating to the use of the % character and escaping: #3485, #6343, #12268, #13648. Perhaps some of these could be tackled at the same time.

comment:7 Changed 5 years ago by ramiro

  • Easy pickings unset
  • Keywords inspectdb added
  • UI/UX unset

comment:8 Changed 5 years ago by Alex

  • Resolution set to duplicate
  • Status changed from new to closed

Marking as a duplicate of #6343.

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