python-3.x - 频谱扫描错误复制镶木地板文件 Redshift
问题描述
我有来自镶木地板文件的复制语句,例如:
COPY schema.table
FROM 's3://bucket/folder/'
IAM_ROLE 'MyRole'
FORMAT AS PARQUET ;
MyRole
政策是:
resource "aws_iam_policy" "PolicyMyRole" {
name = "MyRole"
path = "/"
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": [
"arn:aws:s3:::other/*",
"arn:aws:s3:::folder"
]
},
{
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": [
"arn:aws:s3:::folder/*",
"arn:aws:s3:::folder"
]
},
{
"Effect": "Allow",
"Action": [
"kinesis:*"
],
"Resource": "*"
}
]
}
EOF
}
副本返回错误,例如:
sqlalchemy.exc.InternalError: (psycopg2.InternalError) Spectrum Scan Error
DETAIL:
-----------------------------------------------
error: Spectrum Scan Error
code: 15001
context:
Error: HTTP response error code: 403 Message: AccessDenied Access Denied
x-amz-request-id: 9A5F3F8BB1C6AD5C
x-amz-id-2: 1JwcGdQFUJMec7s97plTFEvaw0EldAsDnYrg56bTpz/QVzbclIiVf/bK4ynGF/T7VNJIcf01PbQ=
query: 20027980
location: dory_util.cpp:929
process: fetchtask_thread [pid=527]
-----------------------------------------------
parquet 文件是使用 pandas Dataframe 创建的:
df.to_parquet(fname=path,compression="gzip",engine='fastparquet', index=False)
文件成功上传到 s3 使用:
os.environ['AWS_PROFILE'] = profile
s3 = boto3.client('s3')
response = s3.upload_file(path, 'bucket', "folder/"+path)
解决方案
推荐阅读
- c - How to implement a 'Pop' function that returns the "popped" element (i.e the data/value) ? (linked list stacks)
- extjs - 两个模型的属性没有显示在 ExtJS 的网格中
- jquery - 如何访问 jquery 数据表列的值以便作为参数传递给控制器
- linux - 将物理内存正常映射到用户空间,结构页面支持的映射
- json - 在 postgres 中将 jsonb 转换为 jsonb 数组
- python - Ubuntu 服务器上的 Python 包
- pycharm - 从 IntelliJ 平台 SDK 中的 Python 类名获取 PsiElement
- ios - 在 Testflight 上发布两个不同的版本
- python-3.x - 用隐藏在右键单击检查元素中的日期填写字段
- python - Python overwrites list values