Opened 16 years ago
Closed 16 years ago
#13028 closed (wontfix)
Introspection doesn't work on mysql 4.1
| Reported by: | pczapla | Owned by: | nobody |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | dev |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
When I ran introspection against mysql 4.1, I've got the following error:
python manage.py inspectdb
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# Feel free to rename the models, but don't rename db_table values or field names.
#
# Also note: You'll have to insert the output of 'django-admin.py sqlcustom [appname]'
# into your database.
from django.db import models
class Wrk(models.Model):
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_manager(settings)
File "/home/pczapla/test/libsdjango-trunk/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/home/pczapla/test/libsdjango-trunk/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/pczapla/test/libsdjango-trunk/django/core/management/base.py", line 195, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/pczapla/test/libsdjango-trunk/django/core/management/base.py", line 222, in execute
output = self.handle(*args, **options)
File "/home/pczapla/test/libsdjango-trunk/django/core/management/base.py", line 351, in handle
return self.handle_noargs(**options)
File "/home/pczapla/test/libsdjango-trunk/django/core/management/commands/inspectdb.py", line 22, in handle_noargs
for line in self.handle_inspection(options):
File "/home/pczapla/test/libsdjango-trunk/django/core/management/commands/inspectdb.py", line 47, in handle_inspection
relations = connection.introspection.get_relations(cursor, table_name)
File "/home/pczapla/test/libsdjango-trunk/django/db/backends/mysql/introspection.py", line 64, in get_relations
AND referenced_column_name IS NOT NULL""", [table_name])
File "/home/pczapla/test/libsdjango-trunk/django/db/backends/util.py", line 19, in execute
return self.cursor.execute(sql, params)
File "/home/pczapla/test/libsdjango-trunk/django/db/backends/mysql/base.py", line 86, in execute
return self.cursor.execute(query, args)
File "/usr/lib64/python2.6/site-packages/MySQLdb/cursors.py", line 173, in execute
self.errorhandler(self, exc, value)
File "/usr/lib64/python2.6/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
django.db.utils.DatabaseError: (1146, "Table 'information_schema.key_column_usage' doesn't exist")
To fix this problem I've added the DatabaseError to the "except" statement in get_relations table.
The patch is attached.
Attachments (1)
Change History (2)
by , 16 years ago
comment:1 by , 16 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | new → closed |
I'm calling this wontfix because MySQL4.1 doesn't provide the metadata that is necessary for inspectdb to work reliably. Hiding the error doesn't fix the problem.
Note:
See TracTickets
for help on using tickets.
quick solution to this issue.