Athena Query result giving back empty table


Hi! I used Athena Query maker to take some data from a CSV file and create a table and database from it. I've added all the columns that I have in my CSV, including the correct types (timestamp, string), the query is correct, it runs, but I get an empty table as an output. I can't tell where is the problem, any idea helps The query:

CREATE EXTERNAL TABLE IF NOT EXISTS `flightsfromcsv`.`detailsofflight` (
  `Departure` timestamp,
  `From` string,
  `Arrival` timestamp,
  `To` string,
  `Companyinfo` string )
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
WITH SERDEPROPERTIES ('field.delim' = ',')
STORED AS INPUTFORMAT 'org.apache.hadoop.mapred.TextInputFormat' OUTPUTFORMAT ''
LOCATION 's3://nameofbucket/'
TBLPROPERTIES ('classification' = 'csv');

The CSV has only the " , " delimiter and it contains the following columns: Departure, From, Arrival, To, Companyinfo

profile picture
asked a year ago1368 views
3 Answers

Athena suggests to use lower case for table names and table column names. Please refer below link

answered a year ago


I noticed that in location parameter for Create Table you have provided backet name only (LOCATION 's3://nameofbucket/'). Make sure that this bucket only consist csv data with schema provided in table DDL. I am suspecting this backet consist other folders and files due to which Athena generated emplty results. Please check this location again and if ithis bucket consist other folder and files, then move the csv file to different prefix and in location provide s3 location till prefix which consist csv files with mentioned schema.

answered a year ago

After creating table you need to add partitions

profile pictureAWS
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions