如何将数据从S3加载到PostgreSQL RDS [英] How to load data from S3 to PostgreSQL RDS

查看:147
本文介绍了如何将数据从S3加载到PostgreSQL RDS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将数据从S3加载到Postgres RDS(大约50-100 GB),我无法选择使用AWS Data Pipeline,并且正在寻找与使用COPY命令加载数据类似的内容。通过S3进入Amazon Redshift。



我将对如何实现此目标提出任何建议。

解决方案

http:/ /docs.aws.amazon.com/redshift/latest/dg/t_loading-tables-from-s3.html


使用COPY命令从
Amazon S3上的数据文件并行加载表。您可以使用Amazon
S3对象前缀或清单文件来指定要加载的文件。



用于指定要加载的文件的语法通过使用前缀,如下所示:

  copy< table_name>来自’s3://< bucket_name> /< object_prefix>的
授权;


更新



另一种选择是安装s3并使用 COPY 命令使用直接到csv的路径。我不确定它是否可以有效容纳100GB,但是值得尝试。 以下是软件选项列表。 / p>

另一种选择是逐段解析 s3文件将此处所述的内容复制到文件中,并从命名管道中 COPY 在此处描述



最明显的选择就是下载文件保存到本地存储并使用 COPY 我根本不介绍



值得一提的是 s3_fdw (状态不稳定)。 自述文件非常简洁,但是我认为您可以创建一个指向s3文件的外部表。这本身意味着您可以将数据加载到其他关系中...


I have a need to load data from S3 to Postgres RDS (around 50-100 GB) I don't have the option to use AWS Data Pipeline and I am looking for something similar to using the COPY command to load data in S3 into Amazon Redshift.

I would appreciate any suggestions on how I can accomplish this.

解决方案

http://docs.aws.amazon.com/redshift/latest/dg/t_loading-tables-from-s3.html

Use the COPY command to load a table in parallel from data files on Amazon S3. You can specify the files to be loaded by using an Amazon S3 object prefix or by using a manifest file.

The syntax to specify the files to be loaded by using a prefix is as follows:

copy <table_name> from 's3://<bucket_name>/<object_prefix>'
authorization;

update

Another option is to mount s3 and use direct path to the csv with COPY command. I'm not sure If it will hold 100GB effectively, but worth of trying. Here is some list of options on software.

Yet another option would be "parsing" s3 file part by part with something described here to a file and COPY from named pipe, described here

And the most obvious option to just download file to local storage and use COPY I don't cover at all

Also worth of mentioning would be s3_fdw (status unstable). Readme is very laconic, but I assume you could create a foreign table leading to s3 file. Which itself means you can load data to other relation...

这篇关于如何将数据从S3加载到PostgreSQL RDS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆