Quering CSV file in Athena

1

Hello, I have a CSV file stored in the S3 bucket that is being updated daily. The CSV file has several tabs. each tab is a different table. I want to use this CSV file as a DB in QuickSight AWS. I use this query-

CREATE EXTERNAL TABLE IF NOT EXISTS Harvesting ( BatchID int, Crop int, HarvestingDate date, FlowersAmount int )

ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LOCATION 's3://vf-flowers/' TBLPROPERTIES ('skip.header.line.count'='1');

Currently, this pulls all the data from all the tabs. How can I create a different table for each tab in the CSV?

Thanks in advance, Mia

asked 2 months ago161 views
2 Answers
1

Hello there,

If you have multiple tabs, then it should be an Excel sheet.

When you convert Excel sheet to CSV file, each tab in the sheet should be converted into a seperate CSV file. So that, each CSV file will contain the data from the corresponding tab in the Excel sheet.

When you create multiple CSV files, create new table for each sheet in Athen/Glue Database.

AWS
sai
answered 2 months ago
  • Is it possible to do this with an Xlsx file? When I'm trying to query the file I get this error - UTF-8 encoding is required, which I don't get when the file is CSV

0

Is it possible to do this with an Xlsx file? When I'm trying to query the file I get this error - UTF-8 encoding is required, which I don't get when the file is CSV

answered 2 months 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