2010/11/14 Rishu <pareshverma...@gmail.com>: > Hi all, > I have a project in which I am supposed to use mysql. The database > already made up. I am facing an issue with the primary key check. > Whensover i insert a duplicate value for the primary key i end up with > a ticket rather than a graceful handling. > Here's the db model: > > db.define_table('document', > > Field('sno','integer',requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB(db,'document.sno')]), > Field('doc_no','string',requires=[IS_NOT_EMPTY()]), > Field('issue','date',requires=[IS_NOT_EMPTY()]), > Field('expiry','date',requires=[IS_NOT_EMPTY()]), > Field('summary','text'), > primarykey=['sno'], > migrate=False, > ) > > > and the error that i receive when duplicating is :
What is the type of the 'document.sno'? If its a unique int just set its type to 'id' and don't use primarykey and everything will work. If you there is some other unique int column set it to type 'id'. If there is no unique int column create it, it shell not break functioning of other software that use the database. DAL keyed tables support is fragile and outdated.