LookML Validator Misses Case Statement Errors

  dimension: example {
type: string
sql: CASE WHEN ${order_amount} > 100 THEN 'Large'
WHEN ${order_amount} > 50 THEN 'Medium'
ELSE 'small' ;;
}

In the above example, the CASE statement is incomplete because it’s missing the END . This sort of mistake seems to get past the validator, without even a warning, and break production reports. In the event that a large amount of code was written in the same commit, this sort of issue can be a huge pain to track down. Why doesn’t the validator catch this?

0 1 212
1 REPLY 1

The Code  Validaton process doesn’t check the sql statements inside sql_* parameters. It only checks the LookML and its syntactic validity. For example if you ommit ;;, you will get an error because LookML is invalid. 

The SQL will only return an error when it’s ran as a query against your data source in your explore and then you’ll get a SQL error.

Top Labels in this Space
Top Solution Authors