Reputation: 1923
Trying to get a file from s3 to Postgres and I'm seeing this error:
ERROR: permission denied for function table_import_from_s3
This is what I'm trying:
SELECT aws_s3.table_import_from_s3(
'btr.Ats_20210304',
'ID,NAME,WEBSITE,TYPE,CATEGORY,SUB_CATEGORY,PARENT_ACCOUNT,PARENT_ACCOUNT_ID,REGION,SEGMENT,HOLDING_COMPANY,CUSTOM_FIELDS,TEAM,EMAIL,STREET1,STREET2,CITY,STATE,ZIP,PHONE,COUNTRY,MOBILE,CREATED_BY,UPDATED_BY,UPDATE_AT',
'(FORMAT csv, HEADER true, DELIMITER ",")',
'vdw-dev',
'date/hourly/data_0_0_0.csv.gz',
'us-east-1');
Upvotes: 7
Views: 7618
Reputation: 2838
The following statements grant enough privileges to a user to run the extension functions:
GRANT USAGE ON schema aws_s3 TO myuser;
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA aws_s3 TO myuser;
Upvotes: 16
Reputation: 1923
Fixed by granting permissions in Postgres:
GRANT ALL ON ALL FUNCTIONS IN SCHEMA aws_s3 TO 'user';
Upvotes: 3