I am new to Django and hoping to use it to replace a spider-web of php code I wrote for a registration system. I have some tables in a MySQL database so I thought I'd try to see if Django could inspect it. After updating settings.py I ran:
> env PYTHONPATH=/usr/local/sites/www.mysite.com/web/django > /usr/local/python/lib/python2.4/site-packages/django/bin/django-admin.py > inspectdb --settings=frontend.settings This is the response: # 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 InvoiceNum(models.Model): id = models.IntegerField(primary_key=True) class Meta: db_table = 'invoice_num' class Registrant(models.Model): Traceback (most recent call last): File "/usr/local/python/lib/python2.4/site-packages/django/bin/django-admin.py", line 5, in ? management.execute_from_command_line() File "/usr/local/python/lib/python2.4/site-packages/django/core/management.py", line 1166, in execute_from_command_line for line in action_mapping[action](): File "/usr/local/python/lib/python2.4/site-packages/django/core/management.py", line 699, in inspectdb relations = introspection_module.get_relations(cursor, table_name) File "/usr/local/python/lib/python2.4/site-packages/django/db/backends/mysql/introspection.py", line 57, in get_relations other_field_index = _name_to_index(cursor, other_table)[other_field] File "/usr/local/python/lib/python2.4/site-packages/django/db/backends/mysql/introspection.py", line 24, in _name_to_index return dict([(d[0], i) for i, d in enumerate(get_table_description(cursor, table_name))]) File "/usr/local/python/lib/python2.4/site-packages/django/db/backends/mysql/introspection.py", line 16, in get_table_description cursor.execute("SELECT * FROM %s LIMIT 1" % quote_name(table_name)) File "/usr/local/python/lib/python2.4/site-packages/django/db/backends/util.py", line 12, in execute return self.cursor.execute(sql, params) File "/usr/local/python/lib/python2.4/site-packages/django/db/backends/mysql/base.py", line 31, in execute return self.cursor.execute(sql, params) File "/usr/local/python/lib/python2.4/site-packages/MySQLdb/cursors.py", line 163, in execute self.errorhandler(self, exc, value) File "/usr/local/python/lib/python2.4/site-packages/MySQLdb/connections.py", line 35, in defaulterrorhandler raise errorclass, errorvalue ValueError: year is out of range I'm not sure why "year is out of range" is a problem - maybe because the table has TIMESTAMP column types? Here is the SHOW CREATE TABLE for the registrant table: CREATE TABLE `registrant` ( `seminar_id` int(11) NOT NULL default '0', `continue_id` varchar(255) NOT NULL default '', `customer_id` int(11) NOT NULL default '0', `registrant_num` smallint(6) NOT NULL default '0', `registration_option` varchar(255) NOT NULL default '', `payment_option` varchar(255) default NULL, `card_type` varchar(255) NOT NULL default '', `transaction_id` varchar(255) NOT NULL default '0', `invoice_num` varchar(255) NOT NULL default '0', `confirmation_sent` smallint(6) default NULL, `payment_received` smallint(6) default NULL, `name` varchar(255) NOT NULL default '', `email` varchar(255) NOT NULL default '', `address1` varchar(255) NOT NULL default '', `address2` varchar(255) NOT NULL default '', `city` varchar(255) NOT NULL default '', `state` varchar(255) NOT NULL default '', `zip` varchar(255) NOT NULL default '', `phone` varchar(255) NOT NULL default '', `name_tag` varchar(255) NOT NULL default '', `special_needs` text NOT NULL, `seminar_days` varchar(255) NOT NULL default '', `last_modified` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, PRIMARY KEY (`continue_id`,`registrant_num`), KEY `seminar_id_ind` (`seminar_id`), CONSTRAINT `registrant_ibfk_1` FOREIGN KEY (`seminar_id`) REFERENCES `seminar` (`seminar_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1 This is running Django pulled from svn this morning, python 2.4.2, MySQL 4.1.19 and MySQLDB-python 1.2.1-p2 Any thoughts? Am I going to have to recreate my tables as well? Thanks, Josh --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---