Thanks Niphold, I used your code but now it is showing another error, I 
have seen this error before also but dont know whats exactly wrong here,
Below is my table definition, 

db.define_table('some_rule', 
    Field('rule_id', 'integer', notnull=True),  # (`rule_id` smallint(8) 
unsigned NOT NULL,)
    Field('created_on', 'datetime', notnull=True),  # (`created_on` 
datetime NOT NULL,)
    Field('modified_on', 'datetime', notnull=True),  # (`modified_on` 
datetime NOT NULL,)
    Field('created_by', 'integer', notnull=True),  # (`created_by` int(11) 
NOT NULL,)
    Field('category_id', 'integer', notnull=True),  # (`category_id` 
int(11) NOT NULL,)
    Field('is_active', 'integer', notnull=True),  # (`is_active` tinyint(4) 
unsigned NOT NULL,)
    Field('action', 'string', notnull=True),   # (`action` 
enum('None','Review','Approve','Reject') NOT NULL,)
    Field('score', 'integer', notnull=True),   # (`score` smallint(6) NOT 
NULL DEFAULT '0',)
    Field('field_id', 'integer', notnull=True),  # (`field_id` smallint(5) 
unsigned NOT NULL,)
    Field('params_type', 'integer', notnull=True),  # (`params_type` 
tinyint(3) unsigned NOT NULL,)
    Field('condition', 
requires=IS_IN_SET(['IsEqual','IsNotEqual','IsGreater','IsLesser','IsNull','IsNotNull','Likeliness','IsMatch','IsNotMatch','In','NotIn','Found','NotFound'])),
 
 
    Field('description', 'string', notnull=True),  # (`description` 
varchar(255) NOT NULL,)
    Field('params', 'string', notnull=True),   # (`params` varchar(255) NOT 
NULL,)
    migrate='some_rule.table'
    )

But this one gives me an error as,

  <class '_mysql_exceptions.ProgrammingError'> (1064, "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 'condition VARCHAR(255)' at line 
1")

I checked the sql log,
 the last statement at the time of error is 

timestamp: 2012-12-28T12:07:19.578109
ALTER TABLE rms_rule ADD condition VARCHAR(255);

I am developing this application and is stuck at this point please help me


On Thursday, 27 December 2012 19:12:58 UTC+5:30, Niphlod wrote:
>
> Field('condition', requires=IS_IN_SET(['IsEqual','IsNotEqual','IsGreater',
> 'IsLesser','IsNull','IsNotNull','Likeliness','IsMatch','IsNotMatch','In',
> 'NotIn','Found','NotFound']))
>
>
>
> Il giorno giovedì 27 dicembre 2012 13:30:04 UTC+1, ajith c t ha scritto:
>>
>>
>>
>>  Field('condition', 
>> enum('IsEqual','IsNotEqual','IsGreater','IsLesser','IsNull','IsNotNull','Likeliness','IsMatch','IsNotMatch','In','NotIn','Found','NotFound'),
>>  
>> notnull=True), 
>>
>> the above syntax gives me error while defining the table in web2py.  how 
>> can one specify an enum datatype in web2py table definition
>>
>

-- 



Reply via email to