Hi all,
        I'm trying to introspect an old MySQL database (the old software  
that used the database was written in some nasty mix of Perl and C;  
it just bit the dust recently).  I try an inspectdb on it, and I get  
an ugly-looking stack trace.  Is 'inspectdb' expected to work?; has  
anyone recently used it on MySQL?

        The table that it appears to get stuck on, has fields of an  
autoincrement int pk, an enum, an int (used as a foreignkey to  
another table), a text field, and an auto timestamp field.  The final  
error is "1- isn't a valid int()" (see stack trace below); there are  
no "1-"'s in the table, unless the enum's feeding it one somehow  
(I've no idea how to check that?).  I'm assuming that means a code  
bug somewhere?; is this a known bug?; anyone know if it's in Django  
or MySQLdb (or should I go hunting)?

        I'm running on MacOS X, with Django from svn head, and dependencies  
from Fink.

Thanks,
Adam


adam$ ./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  
sqlinitialdata [appname]'
# into your database.

from django.db import models

class [aseering: Munged Table Name Here](models.Model):
Traceback (most recent call last):
   File "./manage.py", line 11, in ?
     execute_manager(settings)
   File "/sw/lib/python2.4/site-packages/django/core/management.py",  
line 1459, in execute_manager
     execute_from_command_line(action_mapping, argv)
   File "/sw/lib/python2.4/site-packages/django/core/management.py",  
line 1370, in execute_from_command_line
     for line in action_mapping[action]():
   File "/sw/lib/python2.4/site-packages/django/core/management.py",  
line 766, in inspectdb
     relations = introspection_module.get_relations(cursor, table_name)
   File "/sw/lib/python2.4/site-packages/django/db/backends/mysql/ 
introspection.py", line 30, in get_relations
     my_field_dict = _name_to_index(cursor, table_name)
   File "/sw/lib/python2.4/site-packages/django/db/backends/mysql/ 
introspection.py", line 23, in _name_to_index
     return dict([(d[0], i) for i, d in enumerate 
(get_table_description(cursor, table_name))])
   File "/sw/lib/python2.4/site-packages/django/db/backends/mysql/ 
introspection.py", line 15, in get_table_description
     cursor.execute("SELECT * FROM %s LIMIT 1" % quote_name(table_name))
   File "/sw/lib/python2.4/site-packages/django/db/backends/util.py",  
line 12, in execute
     return self.cursor.execute(sql, params)
   File "/sw/lib/python2.4/site-packages/django/db/backends/mysql/ 
base.py", line 42, in execute
     return self.cursor.execute(sql, params)
   File "/sw/lib/python2.4/site-packages/MySQLdb/cursors.py", line  
95, in execute
     return self._execute(query, args)
   File "/sw/lib/python2.4/site-packages/MySQLdb/cursors.py", line  
114, in _execute
     self.errorhandler(self, exc, value)
   File "/sw/lib/python2.4/site-packages/MySQLdb/connections.py",  
line 33, in defaulterrorhandler
     raise errorclass, errorvalue
ValueError: invalid literal for int(): 1-


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to