I have a MySQL table that I'm migrating over to Redshift. The steps are pretty straightforward.
I'm having a problem with the last step. I have headers in my MySQL CSV export. I can't currently recreate it, so I'm stuck with the CSV file. Step 4
is giving me an error because of the headers.
Instead of changing the CSV, I would love to add a line to account for headers. I've searched through AWS's documentation for copying tables which is pretty extensive, but nothing to account for headers. Looking for something like header = TRUE
to add into the query below.
My COPY statement into Redshift right now looks like:
COPY apples FROM
's3://buckets/apples.csv'
CREDENTIALS 'aws_access_key_id=abc;aws_secret_access_key=def'
csv
;
Found the IGNOREHEADER function, but still couldn't figure out where to write it.
Pretty obvious now, but just add IGNOREHEADER at the bottom. The 1 represents the number of rows you want to skip for headers, aka my CSV had one row of headers.
COPY apples FROM
's3://buckets/apples.csv'
CREDENTIALS 'aws_access_key_id=abc;aws_secret_access_key=def'
csv
IGNOREHEADER 1
;
There is a parameter that Copy command can use. Refer to documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With