I'm following the example given in the SQLObject FAQ on creating custom mtm relationships. Creating the unique index for the UserPhonelists table seems to create an incorrect SQL statement.
My code: --- class User(SQLObject): name = StringCol(length=255, default="") [...] phonelists = SQLRelatedJoin('Phonelist',intermediateTable='user_phonelists',createRelatedTable=False) class Phonelist(SQLObject): name = StringCol(length=255) [...] users = SQLRelatedJoin('User',intermediateTable='user_phonelists',createRelatedTable=False) class UserPhonelists(SQLObject): class sqlmeta: table = "user_phonelists" user = ForeignKey('User', notNull=True, cascade=True) phonelist = ForeignKey('Phonelist', notNull=True, cascade=True) [...] unique = index.DatabaseIndex(user, phonelist, unique=True) --- The queries it generates: --- 1/Query : ALTER TABLE user_phonelists ADD CONSTRAINT user_phonelists_user_id_exists FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE 1/Query : ALTER TABLE user_phonelists ADD CONSTRAINT user_phonelists_phonelist_id_exists FOREIGN KEY (phonelist_id) REFERENCES phonelist (id) ON DELETE CASCADE 1/Query : ALTER TABLE user_phonelists ADD UNIQUE unique (user_id, phonelist_id) --- The error the last query triggers: --- sqlobject.dberrors.ProgrammingError: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'unique (user_id, phonelist_id)' at line 1 --- Shouldn't the generated statement be: --- ALTER TABLE user_phonelists ADD UNIQUE (user_id, phonelist_id); --- Regards, Ed ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss