Hi! >> I'm using Django with Firebird and Oracle as backends. When integrating >> with a legacy Firebird database using the inspectdb command, I guess I >> hit a bug in inspectdb.py (although I'm not entirely sure), which does >> affect extracting foreign key relationships. >> >> Starting in line 67: >> >> if i in relations: >> rel_to = relations[i][1] == table_name and "'self'" or >> table2model(relations[i][1]) >> >> >> >> Shouldn't that be: >> >> if column_name in relations: >> rel_to = relations[column_name][1] == table_name and "'self'" or >> table2model(relations[column_name][1]) >> > > The original code appears to be correct for the officially supported > backends. Under SQLite, for example, > connection.introspection.get_relations() returns data of the form: > > {2: (0, u'auth_permission')} > > so relations[i][1] returns 'auth_permission'. > > This suggests to me that the problem lies with the Firebird backend > returning data in the wrong format for some of the introspection > functions.
Ok. Thanks. You are right. The system table query in get_relations of the Firebird backend is messed up. >> I've also made some changes in the Firbird-django backend files for >> better support of: >> >> * the RETURNING clause (Firebird 2.0 and higher) >> * Improved introspection support >> >> Don't know if anybody is interested in those changes. > > Firebird support isn't part of the Django core, so you'll need to take > this up with the maintainers of the Firebird backend. The Google code > project provides a ticket tracker and contact details for the project. Thanks. Regards, Thomas --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---