Is it possible setup headers in AWS Athena CSV files? - csv

I have an AWS Athena service in place.
After the query Athena generates an CSV file.
Let's say I want to see the follow result (with headers) when I open that CSV in the excel or google sheet.
For the line 7 to 13 it is ok. It is actual result from Athena.
I want to add a header (like in the picture).
How do I accomplish that?

It isn't possible, because Athena doesn't support that and also it isn't compatible with CSV format. If you want to add "headers" you can use a workaround by using "union all", but it will not give you the result as you expect.
About CSV format:
https://en.wikipedia.org/wiki/Comma-separated_values

Related

Can't download CSV data from AWS Athena in usable format

I've got 70,000+ CSV files in an S3 bucket. They all have the same headers. I would like to combine the files into one CSV, which I want to download onto my machine.
Using AWS Athena, I seem to be most of the way there. I have created a database from the S3 bucket. I can then run queries like this:
select * from my_table_name limit 100
And see the results of the query (which in my case is combining many CSVs from S3) in the Athena console.
However when I go to "Download results" of that query, I can't open the CSV in Excel (or a text editor).
Doing
file -b my_table_name.csv
returns data.
I'm confused because I can visually see the results of my Athena query but can't download them in a usable file format. Am I missing something obvious for how to download this data? Why isn't it giving me a normal (perhaps UTF-8) CSV?
In Athena settings, I had encryption on. That solved it.

Read a flat file in Pentaho Spoon and then export it's metadata into a CSV

I am wondering if it is possible to extract the metadata of a flat file in a CSV using Pentaho Spoon. What I mean by that is for example get a CSV file input step, choose the file you want to read and then somehow get access to the metadata of that file and export it into a CSV.
I found on the documentation a step called Metadata Structured that was introduced in 3.1.0 but I can't find it in the latest version of Spoon, maybe it got removed by now.
Update: I found the "Metadata structure of stream" that almost does what I need to be done. Right now my transformation looks like this: csv file input -> metadata structure of stream -> text file ouput. The problem is that it doesnt extract all the metadata. It doesn't extract Format, Decimal and Group. It also gets me an Origin column that I don't really need and I have to get rid of it.
Update2: I keep trying to get to those columns that are missing but the problem is that the Metadata structure of stream step only outputs these columns "Position,Fieldname,Comments,Type,Length,Precision,Origin" so I cannot really access the format column for example that is an input for the step :( I can't really find a work-around for this

Tableau isn't converting my csv data source to tables

When I import a csv to Tableau, it gets the same format of the original csv file (a single column with every label on it). How can I make Tableau separate the columns based on commas?
I can't see why this is happening, since in every tutorial I checked Tableau already converts the .csv to a tabular format.
Here's what I get
Note: I'm using Tableau's trial version.
Sometimes when you open a csv in Excel it can mess with the formatting like your image shows. If you think you opened it in Excel before connecting, try downloading your source again and connecting first with Tableau. If that doesn't work, I happen to have this dataset in a .tde if you would like to use that. vgsales.tde
Edit: Thinking regional settings might be a factor.
Click the dropdown on the right of the data source. Select Text File Properties
To get this window:
Can you match these settings?

Convert JSON to CSV using Microsoft Flow

I am trying to parse JSON data from an API into Flow, convert it into a CSV and then output the CSV to my Google Drive.
The API I am trying to work with is located here:
https://www.binance.com/api/v1/klines?symbol=BNBBTC&interval=1h&limit=24
Is this possible using Microsoft flow? I have tried various things without much success.
Thanks in advance.
I'd say it is possible. What have you tried so far?
First you have to get the response body. Then extract the "meat" from each element, which has to be done with flow expressions "body(response_body)[0]" - depending on format. Then feed all these data parts to a newly created excel file.

Jitterbit export to csv with header

Using Jitterbit studio 8.26.1.2.
Trying to transfer data from db to csv. It works but the csv file does not have headers. Would like to have header with names as in the source table.
would like:
id,fname,lname
1,John,Smith
2,Theresa Map
instead:
1,John,Smith
2,Theresa Map
What is the easiest way to achieve this?
simple operation
You can easily do this in your Local File target, but checking the "Write Headers" box, in the options section.
Documents are here: https://success.jitterbit.com/display/DOC/Creating+a+Local+File+Target