Amazon Athena: no viable entry alternative

When creating a table in Athena; this gives me the following exception:

no viable input alternative

+32
amazon-web-services amazon-athena
source share
8 answers

hyphens are not allowed in the table name .. (although the wizard allows this). Just remove the hyphen and it works like a charm

+28
source share

Unfortunately, at the moment, syntax checking error messages are not very descriptive in Athena, this error can mean "almost" any possible syntax errors in the create table statement.

Although this is annoying at the moment, you will need to check if the syntax should follow Create table .

Some examples:

  • Backticks out of place (as already indicated)
  • Missing / extra commas (remember that the last column does not need a comma after defining the column
  • Missing spaces
  • Read more ..
+30
source share

This error usually occurs when there are some dumb errors in the DDL syntax. There are several answers explaining different errors depending on their condition. A simple solution to this problem is to patiently examine DDL and check the following points line by line: -

  1. Check for Missed Commas
  2. Unbalanced "(backstop operator)
  3. Incompatible data type not supported by HIVE ( LINK TO HIVE DATA TYPES )
  4. Unbalanced comma
  5. Hypen in the table title
+2
source share

In my case, it was due to the comma after the last column in the table. For example:

CREATE EXTERNAL TABLE IF NOT EXISTS my_table ( one STRING, two STRING, ) LOCATION 's3://my-bucket/some/path'; 

After I removed the comma at the end of two STRING, it worked fine.

+1
source share

In my case, it was an extra comma in the PARTITIONED BY section,

0
source share

In my case, I was missing the only values ​​for the S3 URL

0
source share

In my case, it was that one of the table column names was enclosed in single quotes according to the AWS documentation :( ('bucket')

0
source share

My case: it was an external table, and there was a typo in this place (therefore, it was not)

A couple of tips:

0
source share

All Articles