Skip to content

Commit 86b7cfa

Browse files
[release-2.37.0][BEAM-13980] Re-add method gone missing in af2f8ee (#16918) (#16967)
Co-authored-by: Janek Bevendorff <janek.bevendorff@uni-weimar.de>
1 parent 82a05e3 commit 86b7cfa

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

sdks/python/apache_beam/io/aws/clients/s3/boto3_client.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,31 @@ def __init__(self, options):
7878
self._download_stream = None
7979
self._download_pos = 0
8080

81+
def get_object_metadata(self, request):
82+
"""Retrieves an object's metadata.
83+
84+
Args:
85+
request: (GetRequest) input message
86+
87+
Returns:
88+
(Object) The response message.
89+
"""
90+
kwargs = {'Bucket': request.bucket, 'Key': request.object}
91+
92+
try:
93+
boto_response = self.client.head_object(**kwargs)
94+
except Exception as e:
95+
raise messages.S3ClientError(str(e), get_http_error_code(e))
96+
97+
item = messages.Item(
98+
boto_response['ETag'],
99+
request.object,
100+
boto_response['LastModified'],
101+
boto_response['ContentLength'],
102+
boto_response['ContentType'])
103+
104+
return item
105+
81106
def get_stream(self, request, start):
82107
"""Opens a stream object starting at the given position.
83108

website/www/site/content/en/blog/beam-2.36.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ notes](https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12319527
5151
* Users may encounter an unexpected java.lang.ArithmeticException when outputting a timestamp
5252
for an element further than allowedSkew from an allowed DoFN skew set to a value more than
5353
Integer.MAX_VALUE.
54+
* S3 object metadata retrieval broken in Python SDK ([BEAM-13980](https://issues.apache.org/jira/browse/BEAM-13980))
5455
* See a full list of open [issues that affect](https://issues.apache.org/jira/issues/?jql=project%20%3D%20BEAM%20AND%20affectedVersion%20%3D%202.36.0%20ORDER%20BY%20priority%20DESC%2C%20updated%20DESC) this version.
5556

5657

0 commit comments

Comments
 (0)