I am trying to copy data from S3 bucket into Redshift using copy
command.
When I pass the exact file name in copy command it works perfectly fine but when I use wildcard (*
) in my from clause it throws an error - "The specified S3 prefix 'suiteX*' does not exist;"
All my files follow this naming convention - SuiteX_Date_Hour.csv
for example - SuiteX-20150101-1.csv
Here is my copy command that works :
copy mytable from 's3://mybucket/suiteX_20150101_1.csv'
CREDENTIALS 'aws_access_key_id=XXXXX;aws_secret_access_key=XXXX'
delimiter ',' REGION AS 'us-east-1';
Here is the copy command that does not work:
copy mytable from 's3://mybucket/suiteX*'
CREDENTIALS 'aws_access_key_id=XXXXX;aws_secret_access_key=XXXX'
delimiter ',' REGION AS 'us-east-1';
Any idea how can make copy command to work with wildcard when I copy data from S3 ?
According to the Redshift docs, I don't think COPY command supports wildcard for s3 file source path. Instead, you can specify a bucket directory as follows.
In this case, the files under
data/
directory will be copied to Redshift.