percious wrote: > Here is the dump: > ...<snip>... > sqlalchemy.exceptions.SQLError: (OperationalError) (1071, > 'Specified key was too long; max key length is 999 bytes') > '\nCREATE TABLE `Album` (\n\tid INTEGER NOT NULL > AUTO_INCREMENT, \n\tname VARCHAR(128), \n\tdirectory > VARCHAR(512), \n\t`imageOrder` VARCHAR(512), \n\t`coverImage` > INTEGER, \n\tPRIMARY KEY (id), \n\t UNIQUE (directory), \n\t > FOREIGN KEY(`coverImage`) REFERENCES `Image` (id)\n)\n\n' () > > Here is the table code: > AlbumTable = Table('Album', metadata, > Column('id', Integer, primary_key=True), > Column('name', Unicode(128)), > Column('directory', Unicode(512), unique=True), > Column('imageOrder', Unicode(512)), > Column('coverImage', Integer, ForeignKey('Image.id')), > ) > Mysql version 5.0.27 > > TIA > -chris
I think this is because of your 'unique=True' on your Unicode directory column. MySQL is building a unique index on that column, and the number of bytes that it uses per character varies depending on the encoding. If it is UTF-16, for example, it will use 2 bytes per character, so your VARCHAR(512) column would be 1024 bytes, and as the error message says, the max key length is 999 bytes. This is a MySQL problem, not SQLAlchemy. I don't know what the solution is - you may need to play with MySQL's character encoding. See for example things like: http://www.xaprb.com/blog/2006/04/17/max-key-length-in-mysql/ Hope that helps, Simon --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---