Home > Software design >  AWS Athena query returning empty string
AWS Athena query returning empty string

Time:01-20

I've seen other questions saying their query returns no results. This is not what is happening with my query. The query itself is returning empty strings/results.

I have an 81.7MB JSON file in my input bucket (input-data/test_data). I've setup the datasource as JSON.

However, when I execute SELECT * FROM test_table; it shows (in green) that the data has been scanned, the query was successful and there are results, but not saved to the output bucket or displayed in the GUI.

I'm not sure what I've done wrong in the setup?

This is my table creation:

CREATE EXTERNAL TABLE IF NOT EXISTS `test_db`.`test_data` (
  `tbl_timestamp` timestamp,
  `colmn1` string,
  `colmn2` string,
  `colmn3` string
)
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe' 
WITH SERDEPROPERTIES (
  'serialization.format' = '1'
) LOCATION 's3://input-data/test_data/'
TBLPROPERTIES ('has_encrypted_data'='false',
               'skip.header.line.count'='1');

enter image description here

CodePudding user response:

Resolved this issue. The labels of the table (e.g. the keys) need to be the same labels in the file itself. Simple really!

  •  Tags:  
  • Related