Donna,
>Try looking at the information_schema.KEY_COLUMN_USAGE table (where
>referenced_table_schema is not null). It will show you the FK
>relationships. You could then create a tree that you could use to find the
>hierarchy. For that, I suggest looking at
>http://www.artfulsoftware.com/infotree
Try looking at the information_schema.KEY_COLUMN_USAGE table (where
referenced_table_schema is not null). It will show you the FK
relationships. You could then create a tree that you could use to find the
hierarchy. For that, I suggest looking at
http://www.artfulsoftware.com/infotree/mysqlquer
Sounds like you want to walk tables in order of their fk dependencies
- a topological ordering. You might want to take a look at SQLAlchemy
which has some methods to do just this in sqlalchemy.sql.util:
def sort_tables(tables, reverse=False):
"""sort a collection of Table objects in order of
Andy Shellam wrote:
Am I missing something here? (It is late after a long day, I admit!)
Only something I forgot to mention.
All the foreign keys are set up as ON DELETE RESTRICT, meaning MySQL's
response to a foreign key violation is to spit out an error message to the
effect of "I'm sorry
Hi Philip,
Am I missing something here? (It is late after a long day, I admit!)
In the example case you've given, if the foreign key in Parts is set to
ON DELETE CASCADE, and you delete a row from Manufacturer, MySQL will
first delete the associated records in Parts before deleting the row
f
Hi,
First of all, I apologise in advance for any mind-altering, or
headache-inducing effects this question may have. I've spent the past two days
trying to figure it out, and all I've got to show for it is a mostly-working
recursive depth-first-search routine and an empty packet of painkiller