Error while export using aws_s3.query_export_to_s3 function.
Hello! I'm just trying to use your aws_s3 extention.
When runing this query
SELECT * FROM aws_s3.query_export_to_s3(
query => '
select
json_agg(post_main_approved)
from asmo.post_main_approved
limit 10 ;
',
bucket => 'arn:aws:s3:::asmo-ij-json',
file_path => 'test.json',
region => 'eu-central-1a',
access_key => '<access_key>',
secret_key => '<secret_key>'
);
then get this error:
error fetching next item from iterator. spiexceptions.SyntaxError: syntax error at or near ";"
Can you help to deal with this issue? Thanks!
I believe this is caused by the semicolon used to terminate your query following the limit parameter, I.e. limit 10;. Try removing the semicolon.
I was having the same issue while trying to inline my uri creation like so;
const statement: string = `SELECT * FROM aws_s3.query_export_to_s3( \
'SELECT * FROM ${tablename}', \
aws_commons.create_s3_uri( \
${bucket_name}, \
${csv_out_path}, \
${region} \
); \ ${/* <= spiexceptions.SyntaxError: syntax error at or near ";" */}
);`