Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

When retrieving data from S3, account for chunking #1085

Merged
merged 5 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Fixed - `.ipynb` output in tutorials is not visible in dark mode ([#1078](https://github.com/datajoint/datajoint-python/issues/1078)) PR [#1080](https://github.com/datajoint/datajoint-python/pull/1080)
- Changed - Readme to update links and include example pipeline image
- Changed - Docs to add landing page and update navigation
- Changed - `.data` method to `.stream` in the `get()` method for S3 (external) objects PR [#1085](https://github.com/datajoint/datajoint-python/pull/1085)
- Fixed - Docs to rename `create_virtual_module` to `VirtualModule`

### 0.14.0 -- Feb 13, 2023
Expand Down
4 changes: 3 additions & 1 deletion datajoint/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ def fput(self, local_file, name, metadata=None):
def get(self, name):
logger.debug("get: {}:{}".format(self.bucket, name))
try:
return self.client.get_object(self.bucket, str(name)).data
with self.client.get_object(self.bucket, str(name)) as result:
data = [d for d in result.stream()]
return b"".join(data)
except minio.error.S3Error as e:
if e.code == "NoSuchKey":
raise errors.MissingExternalFile("Missing s3 key %s" % name)
Expand Down