我想在Windows中运行以下代码来获取s3对象的前几行:
import boto3
s3 = boto3.client('s3')
sql_stmt = """select * from s3object limit 5"""
req = s3.select_object_content(
Bucket=bucket,
Key=file,
ExpressionType='SQL',
Expression=sql_stmt,
InputSerialization = {'CSV': {'FileHeaderInfo': 'Use', 'FieldDelimiter': ','}},
OutputSerialization = {'CSV': {}})它一直在告诉我:
An error occurred (InvalidRequest) when calling the SelectObjectContent operation:
S3 Transfer Acceleration is not configured on this bucket这可能与我今年早些时候尝试测试传输加速有关(它不起作用)。我尝试使用aws cli确认并禁用传输加速:
aws configure set default.s3.use_accelerate_endpoint false我可以从EMR集群运行相同的代码,所以这个错误肯定是我的Windows环境中的本地错误。如何关闭传输加速??
发布于 2020-10-27 23:40:04
您的boto3应用程序是使用非默认AWS配置文件(例如,通过AWS_PROFILE环境变量或some other supported way设置)启动的,或者您的~/.aws/config文件不正确。
如果使用默认配置文件,那么我会检查~/.aws/config是否如下所示:
[default]
region = us-east-1
s3 =
signature_version = s3v4
use_accelerate_endpoint = falsehttps://stackoverflow.com/questions/64557755
复制相似问题