Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon Redshift error: Mandatory url not present in manifest file

I have the following manifest file

{
  "entries": [
    {
      "url": "s3://gcmregtokenvalidation/registrations_invalid_token/registration_master_2017-07-25T10:47:40.049+05:30.gz",
      "mandatory": true
    },
    {
      "url": "s3://gcmregtokenvalidation/registrations_invalid_token/registration_master_2017-07-25T10:47:59.441+05:30.gz",
      "mandatory": true
    },
    {
      "url": "s3://gcmregtokenvalidation/registrations_invalid_token/registration_master_2017-07-25T10:48:19.297+05:30.gz",
      "mandatory": true
    },
    {
      "url": "s3://gcmregtokenvalidation/registrations_invalid_token/registration_master_2017-07-25T10:48:40.277+05:30.gz",
      "mandatory": true
    }
  ]
}

and following copy command

COPY registrations_invalid_token
FROM  's3://locationnew/redshiftloader-
manifest/registrations_invalid_token_25_07_2017_11:55:11.manifest' 
CREDENTIALS 'aws_access_key_id=XXX;aws_secret_access_key=XXX'
manifest gzip delimiter ',' dateformat 'auto'
FILLRECORD IGNOREBLANKLINES TRIMBLANKS TRUNCATECOLUMNS
MAXERROR 100000 region 'ap-south-1';

I got the following exception

Amazon Invalid operation: Mandatory url is not present in manifest file. Details:
----------------------------------------------- error: Mandatory url is not present in manifest file. code: 8001 context:
Manifest file location=s3://locationnew/redshiftloader-manifest/registrations_invalid_token_25_07_2017_11:55:11.manifest url=s3://gcmregtokenvalidation/registrations_invalid_token/registration_master_2017-07-25T10:47:40.049+05:30.gz query: 1475619 location: s3_utility.cpp:337 process:
padbmaster [pid=32720]
-----------------------------------------------;

Why I am getting such an error?

like image 888
Don Jose Avatar asked Jul 25 '17 06:07

Don Jose


People also ask

What is manifest file in redshift?

The manifest file is a text file in JSON format that Amazon Redshift uses to connect to the host. The manifest file specifies the SSH host endpoints and the commands that are run on the hosts to return data to Amazon Redshift.

What is manifest JSON AWS?

You use JSON manifest files to specify files in Amazon S3 to import into Amazon QuickSight. These JSON manifest files can use either the Amazon QuickSight format described following or the Amazon Redshift format described in Using a manifest to specify data files in the Amazon Redshift Database Developer Guide.

What is a manifest file in S3?

A manifest is a CSV file where each row is an S3 object in the job. Your CSV manifest must contain fields for the object's bucket and key name.


1 Answers

The Using a Manifest to Specify Data Files documentation says:

The optional mandatory flag specifies whether COPY should return an error if the file is not found. The default of mandatory is false. Regardless of any mandatory settings, COPY will terminate if no files are found.

The Mandatory url is not present in manifest file error is badly worded, but it might be saying that the specified file could not be found on Amazon S3.

You could test it with:

aws s3 ls s3://gcmregtokenvalidation/registrations_invalid_token/registration_master_2017-07-25T10:47:40.049+05:30.gz

Also, try setting mandatory to false to see if the error disappears.

like image 170
John Rotenstein Avatar answered Oct 20 '22 11:10

John Rotenstein