O'Reilly logo

Getting Started with Amazon Redshift by Stefan Bauer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The copy command

Now that you have copied the sample data files to your S3 bucket, we can actually copy the data into the tables. There are two copy commands that we will now review, the first one of which will load the dimension. I have used a fixed layout definition for this data file.

copy all_fips_codes from 's3://testing/redshift/FIPS_CountyName.txt'
credentials
'aws_access_key_id=<yourkey>;aws_secret_access_key=<yourkey>'
fixedwidth '0:5,1:50';

As this is the first copy command, let's take it a little slow and walk through the command and the options I have supplied:

  • copy: The copy command
  • all_fips_codes: This is the target table
  • from 'S3 bucket/FIPS_Countyname.txt': This is the S3 bucket location and the file you uploaded
  • credentials 'aws_access_key_id; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required