Using SQL Runner to check errors

(Paola) #1

To learn about SQL Runner, see this document page and choose release 4.16 or higher.

In your explore, you may run into this error:

SQL Syntax Error: You have an error in your SQL syntax; check the manual that 
corresponds to your server version for the right syntax to use near.

If this occurs, it means your SQL code might have:

  • Spelling errors
  • Wrongly arranged or missing commands
  • Function specific problem such as, inputting the wrong type
  • Incorrect or missing quotation marks in the SQL parameter of a dimension or measure.

You can troubleshoot the error by using SQL Runner. Click the SQL tab in the upper left corner of the Data section and click Open in SQL Runner in the bottom right corner.

This will automatically copy the generated SQL to your SQL Runner. This way, you can make changes and re-run the query without having to go back and forth between your LookML and Explore. Once the error is found, you can go back into your LookML and implement the fix.

Starting with Looker 4.8, SQL Runner highlights the location of the first syntax error in the SQL command and includes the position of the error in the error message:

If your PDT is producing a SQL error, refer to this discourse: [Using SQL Runner to Test Derived Tables] (Using sql runner to test derived tables)

(Mike DeAngelo (a.k.a. Dr. StrangeLooker)) #2

I see these frequently — thanks for writing it up

(erin.alexander) #3

Starting in 4.8, SQL Runner highlights SQL errors and provides the position of the error in the error message, so I’ve added the information to this article.