如何将数据从S3加载到PostgreSQL RDS

编程入门 行业动态 更新时间:2024-10-26 14:40:45
本文介绍了如何将数据从S3加载到PostgreSQL RDS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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

解决方案

http:/ /docs.aws.amazon/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.

解决方案

docs.aws.amazon/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

本文发布于:2023-10-17 12:54:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1500956.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何将   加载   数据   PostgreSQL   RDS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!