Athena Query result giving back empty table

0

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 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
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
demandé il y a un an1196 vues
3 réponses
0

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

https://docs.aws.amazon.com/athena/latest/ug/tables-databases-columns-names.html

Kiran
répondu il y a un an
0

Hello,

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.

AWS
répondu il y a un an
0

After creating table you need to add partitions

MSCK REPAIR TABLE <tablename>
;
profile pictureAWS
répondu il y a un an

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions