Opened 16 years ago

Closed 13 years ago

#9164 closed Bug (duplicate)

mysql backend, foreign key respect order

Reported by: cristofaro.campagna@… Owned by: nobody
Component: Core (Management commands) Version: 1.0
Severity: Normal Keywords: foreignkey inspectdb
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Introspection mysql backend not respect order on foreing key. List of table extract by function get_table_list using "show table", this command not return correct response for goal.
Show tables return list table into db, but these haven't order in models.py definition.

es.

class A(models.Model):

cma = models.ForeignKey(B)

class B(models.Model):

att = models.CharField(max_length=60, blank=True)

In this example B is not define class

For resolve problem i just implemented new introspection.py and attach in this ticket

Bye!

Attachments (2)

introspection.py (5.4 KB ) - added by cristofaro.campagna@… 16 years ago.
diff-introspection-mysql (1.9 KB ) - added by cristofaro.campagna@… 16 years ago.

Download all attachments as: .zip

Change History (7)

by cristofaro.campagna@…, 16 years ago

Attachment: introspection.py added

comment:1 by Malcolm Tredinnick, 16 years ago

Triage Stage: UnreviewedAccepted

Please create a diff against the current code so that we can see what changed (run svn diff from the top of the source tree). It shouldn't need to be a big change to sort things correctly, I would expect. There are at least two ways to do it: sorting the model definitions, or using string names for forwards references when one model comes before another. It's not always possible to sort things so that everything is a backwards reference, so the string names version may be shorter; we'll have to see.

by cristofaro.campagna@…, 16 years ago

Attachment: diff-introspection-mysql added

comment:2 by Gabriel Hurley, 14 years ago

Component: django-admin.py inspectdbCore (Management commands)

comment:3 by Luke Plant, 14 years ago

Severity: Normal
Type: Bug

comment:4 by Ramiro Morales, 13 years ago

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

comment:5 by Ramiro Morales, 13 years ago

Resolution: duplicate
Status: newclosed

I'm going to close this as a duplicate of #15076 that presents and proposes resolution of the same issue but in a non MySQL-specific fashion.

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