[英]How to execute AWS S3 to Redshift Copy command from SQL script?
I am trying to copy some files from S3 to Redshift using copy command. 我正在尝试使用copy命令将某些文件从S3复制到Redshift。 I used following command through SQL workbench and it worked fine, it copied the data to Redshift Table. 我通过SQL工作台使用以下命令,效果很好,它将数据复制到Redshift Table。
copy <Redshift table name>
from 's3://my-bucket/path/to/directory/part'
iam_role 'arn:aws:iam::<IAM ROLE>'
delimiter '|' dateformat 'auto' IGNOREHEADER AS 1;
but when I copied the same command into .sql
file and tried to execute this SQL file using AWS data pipeline, pipeline just fails without giving any explicit error. 但是,当我将同一命令复制到.sql
文件并尝试使用AWS数据管道执行此SQL文件时,管道会失败而没有给出任何显式错误。
Due to some issues with internally developed pipeline definition generation tool, I am not able to use CopyToRedshift
type activity. 由于内部开发的管道定义生成工具存在一些问题,因此我无法使用CopyToRedshift
类型的活动。
I would like to know how do I execute this copy command from an file? 我想知道如何从文件执行此复制命令?
Try this out !! 试试这个!
COPY Table_Name 复制表名
FROM S3File_PATH 来自S3File_PATH
credentials "*AWS Credentails" 凭证“ * AWS Credentails”
ignoreheader as 1 ignoreheader为1
ACCEPTINVCHARS ACCEPTINVCHARS
delimiter '|' 分隔符'|'
This copy command should work from a sql file .If not try to check for any errors in stl_load_error_details 此复制命令应从sql文件运行。如果不尝试检查stl_load_error_details中的任何错误
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.