Search code examples
sqlamazon-web-servicesaws-cloudformationiotaws-iot

AWS IoT SQL Rule


Am trying to execute the IoT Rule as part of the CFT template. This rule has to ignore the message which has this field sNumber starting with F0F1. The rule is like

SELECT * FROM 'topic/+/+/+' WHERE 'sNumber' NOT LIKE 'F0F1%'

But, am facing this error:

Resource handler returned message: "Expected a comparison operation: StringNode(sNumber) 'sNumber' NOT LIKE 'F0F1%' --------------------------------------------------------------------------------------------------------------------------------^ at 1:34 (Service: Iot, Status Code: 400, Request ID: 75e91f11-05c8-4e22-8cd7-0a3567261695, Extended Request ID: null)" (RequestToken: 6cd8d39d-1b2d-4076-6253-60212009a63a, HandlerErrorCode: InvalidRequest)

Can you help me understand what need to be done to achieve my requirement.


Solution

  • Try using startswith() function

    SELECT * FROM 'topic/+/+/+' WHERE NOT startswith(sNumber, 'F0F1')