Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load CSV into Redshift, with header?

Is there an option to load a CSV into Redshift with a header? I see the documentation for CSV but it says nothing about a header. Ideally it could use the header to determine the columns to load.

like image 733
Some Guy Avatar asked Mar 01 '15 01:03

Some Guy


People also ask

How do I import data from a CSV file to a Redshift table?

The easiest way to load a CSV into Redshift is to first upload the file to an Amazon S3 Bucket. You can follow the Redshift Documentation for how to do this. After that you can use the COPY command to tell Redshift to pull the file from S3 and load it to your table.

What is the most efficient and fastest way to load data into Redshift?

A COPY command is the most efficient way to load a table. You can also add data to your tables using INSERT commands, though it is much less efficient than using COPY. The COPY command is able to read from multiple data files or multiple data streams simultaneously.

How do I import data from Excel to Redshift?

Connecting Excel to Amazon Redshift with Microsoft QueryStart Excel, click the Data tab. In the appeared ribbon, click From Other Sources, and then click From Microsoft Query. In the next dialog, choose the data source you want to connect to (e.g., using data source name - Devart ODBC Amazon Redshift).


1 Answers

Use the IGNOREHEADER 1 option when using the COPY command:

IGNOREHEADER [ AS ] number_rows

Treats the specified number_rows as a file header and does not load them. Use IGNOREHEADER to skip file headers in all files in a parallel load.

See: Amazon Redshift COPY command documentation

like image 104
John Rotenstein Avatar answered Oct 08 '22 00:10

John Rotenstein