Amazon Aurora PostgreSQL SELECT INTO OUTFILE S3 [英] Amazon Aurora PostgreSQL SELECT INTO OUTFILE S3
问题描述
我们正在尝试将数据从 Amazon Aurora PostgreSQL 数据库导出到 S3 存储桶.使用的代码是这样的:
We are trying to export data from an Amazon Aurora PostgreSQL database to an S3 buckets. The code being used is like this:
SELECT * FROM analytics.my_test INTO OUTFILE S3
's3-us-east-2://myurl/sampledata'
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n';
MANIFEST ON
OVERWRITE ON;
已设置所有权限,但出现错误
All permissions have been set up but we get the error
SQL 错误 [42601]:错误:INTO"位置或附近的语法错误位置:55
SQL Error [42601]: ERROR: syntax error at or near "INTO" Position: 55
这只适用于 MySQL 数据库吗?
Does this only work with a MySQL database?
推荐答案
这是 Aurora Postgres 上相当新的功能,但可以将查询结果导出到 s3 上的文件中:https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/postgresql-s3-export.html#postgresql-s3-export-file
It is fairly new feature on Aurora Postgres, but it is possible to export the query result into a file on s3: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/postgresql-s3-export.html#postgresql-s3-export-file
虽然语法与 MySQL 不同.对于 Postgres,它是:
The syntax is not the same as for MySQL though. For Postgres it is:
SELECT * from aws_s3.query_export_to_s3('select * from sample_table',
aws_commons.create_s3_uri('sample-bucket', 'sample-filepath', 'us-west-2')
);
这篇关于Amazon Aurora PostgreSQL SELECT INTO OUTFILE S3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!