SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site, support.twilio.com, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to help.twilio.com, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

Reverse ETL Syntax Error: Expected ")" but Got ";"

Issue

When executing a Reverse ETL model query in the Segment workspace, the query fails to run and returns the message: googleapi: Error 400: Syntax error: Expected ")" but got ";". Customers typically encounter this syntax error in the Query Builder when attempting to preview data or run a sync.

 

Product

Segment

 

Environment

Segment Console

 

Cause

Segment Reverse ETL executes your custom SQL queries by wrapping them in a Common Table Expression (CTE), which can only bind the results from one single subquery. If you include one or multiple semicolons (;) in your query, the system treats them as multiple separate subqueries. Even if the semicolon is simply placed inside an inline comment, it breaks the CTE execution and triggers the syntax error.

 

Resolution

To resolve this error, you need to ensure your query is treated as a single subquery:

  1. Navigate to Connections > Sources, select the Reverse ETL tab, and choose your source.
  2. Select the affected model and open it in the SQL Editor.
  3. Review your SQL statement and remove all semicolons (;) from the query, paying close attention to any semicolons hidden within inline comments.
  4. Click Preview to verify that the query now runs successfully without the syntax error.
  5. Save your changes to the model.

 

Additional Information 

If you are copying and pasting complex queries from external tools into the Segment Query Builder, it is recommended to use a SQL minifier to ensure all unnecessary formatting, tabs, and hidden characters are removed before pasting.

Have more questions? Submit a request
Powered by Zendesk