【发布时间】:2021-10-30 12:06:55
【问题描述】:
我正在尝试使用 Glue 将 python 列表 data_issues(<class 'list'> 类型)保存到 Amazon S3 存储桶,但出现以下错误:
Parameter validation failed:
Invalid type for parameter Body, value:
[('document_entity_sdi', Exception("For column, int and YES don't match.")),
('account_status_sdi', Py4JJavaError('An error occurred while calling o80.getCatalogSink.\n', JavaObject id=o654)),
('account_transaction_fcs_status', Py4JJavaError('An error occurred while calling o80.getCatalogSink.\n', JavaObject id=o797)),
('purchase_order_agreement', Py4JJavaError('An error occurred while calling o80.getCatalogSink.\n', JavaObject id=o21565))],
type: <class 'list'>, valid types: <class 'bytes'>, <class 'bytearray'>, file-like object
我尝试了这种解决方法来转换列表 bytes(data_issues) 但不起作用:
BUCKET = 'bucket_name'
s3 = boto3.client('s3')
keyid = 'keyID'
print("Uploading S3 object with SSE-KMS")
s3.put_object(Bucket=BUCKET,
Key='encrypt-key',
Body=bytes(data_issues),
ServerSideEncryption='aws:kms',
SSEKMSKeyId=keyid)
print("Saving to S3, Done")
【问题讨论】:
-
data_issues是我要打印的列表。data_issues = [('value', Exception("text value")), ('value', {values, values})]
标签: python amazon-web-services amazon-s3 aws-glue