@event.listens_for(ServiceRouterBinding.resource_type, 'set', retval=True)
def validate_resource_type(target, value, oldvalue, initiator):
 maxlen = ServiceRouterBinding.resource_type.property.columns[0].type.length
 if (len(value) > maxlen):
  raise AttributeException(resource_type=value, maxlen=maxlen)
 return value

@ event . listens_for ( ServiceRouterBinding . resource_type , 'set' , retval = True ) def validate_resource_type ( target , value , oldvalue , initiator ) : maxlen = ServiceRouterBinding . resource_type . property . columns [ 0 ] . type . length if ( len ( value ) > maxlen ) : raise AttributeException ( resource_type = value , maxlen = maxlen ) return value
make sure the resource type fit the resource_type column .