Skip to content

Commit 13cb2be

Browse files
committed
When retrieving data from S3, account for chunking
1 parent ee95f02 commit 13cb2be

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

datajoint/s3.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ def fput(self, local_file, name, metadata=None):
6868
def get(self, name):
6969
logger.debug("get: {}:{}".format(self.bucket, name))
7070
try:
71-
return self.client.get_object(self.bucket, str(name)).data
71+
with self.client.get_object(self.bucket, str(name)) as result:
72+
data = [d for d in result.stream()]
73+
return b"".join(data)
7274
except minio.error.S3Error as e:
7375
if e.code == "NoSuchKey":
7476
raise errors.MissingExternalFile("Missing s3 key %s" % name)

0 commit comments

Comments
 (0)