【问题标题】:How to directly copy Amazon Athena tables into Amazon Redshift?如何将 Amazon Athena 表直接复制到 Amazon Redshift?
【发布时间】:2020-06-21 03:02:17
【问题描述】:

我在 S3 中有一些 JSON 文件,我能够从这些数据文件在 Amazon Athena 中创建数据库和表。完成了,我的下一个目标是将这些创建的表复制到 Amazon Redshift 中。我基于这些数据文件创建的 Amazon Athena 中还有其他表。我的意思是我使用 S3 中的那些数据文件创建了三个表,后来我使用这三个表创建了新表。所以目前我有 5 个不同的表想要在 Amazon Redshift 中创建有数据或没有数据的表。

我检查了 Amazon Redshift 中的 COPY 命令,但没有针对 Amazon Athena 的 COPY 命令。这是可用的列表。

  • 从 Amazon S3 复制
  • 从 Amazon EMR 复制
  • 从远程主机 (SSH) 复制
  • 从 Amazon DynamoDB 复制

如果没有其他解决方案,我计划根据 Amazon Athena 中新创建的表将新的 JSON 文件创建到 S3 存储桶中。然后我们可以轻松地将这些从 S3 复制到 Redshift 中,不是吗?有没有其他好的解决方案?

【问题讨论】:

  • 没有 AWS 本地方法可以做到这一点,您需要编写某种脚本来处理该迁移。

标签: amazon-web-services amazon-s3 amazon-redshift amazon-athena


【解决方案1】:

如果您的 s3 文件格式正常,您可以使用 Redshift Spectrum。

1) 设置您的 s3 文件的配置单元元数据目录,如果您愿意,可以使用 aws 胶水。

2) 设置 Redshift Spectrum 以查看 redshift 内的数据 (https://docs.aws.amazon.com/redshift/latest/dg/c-getting-started-using-spectrum.html)

3) 使用 CTAS 在 redshift 内部创建副本

create table redshift_table as select * from redshift_spectrum_schema.redshift_spectrum_table;

【讨论】:

    猜你喜欢
    • 2017-12-26
    • 2021-08-16
    • 1970-01-01
    • 2018-09-12
    • 2013-02-22
    • 2014-09-11
    • 1970-01-01
    • 2016-12-20
    • 2019-12-02
    相关资源
    最近更新 更多