Dealing with reserve Words in Athena

Knowledge Drop

Last tested: Apr 13, 2020
 

Scenario:

We have a table in that we want to query in Athena, whose column name is one of the reserved words. How can we get around this and select the column without having the update/change the name within the database table?

Screen Shot 2020-04-13 at 6.34.56 PM.png

As referenced in the Athena Doc, we'll see that 'group' is listed as a reserved word, which will prohibit us from querying for that table in our select statement.

Solution:

As stated in the docs, we'll want to add double quotes around the reserved word when querying it in SELECT statements. Adding double quotes around the column name to sql parameter will equate to that within Looker.

By adding the double quotes around the column name in the SQL parameter of our LookML definition, Looker encloses the quotes that around in the field name in the generated SQL which will then allow us to select our reserved word column.

This content is subject to limited support.                

Version history
Last update:
‎07-07-2021 01:59 PM
Updated by: