fsspec / fsspec/s3fs

Add ability to check integrity of uploaded object

Open
#431 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1k
Forks
305
Avg merge
22h 37m
Merged PRs (30d)
4

Description

Hi Folks,

I've been reading https://aws.amazon.com/premiumsupport/knowledge-center/data-integrity-s3/ and I'm wondering whether s3fs could/does already support this functionality?

I've got a situation where I request a file from a data provider and in a separate request I can get the checksum of the file.

What I'd like to do is use s3fs to write the file and verify the integrity of the uploaded object by providing the checksum the data provider gives me, something like:

r = requests.get("a-url", stream=True)
if r.status_code == 200:
    try:
        with s3fs.open(f"<bucket-name>/object.type", "wb", md5checksum="ACHECKSUM") as file_out:
            shutil.copyfileobj(r.raw, file_out)
    except IntegrityError as ex:
        # Tidy up here

I've tried using the .checksum() function, but this doesn't return me the correct checksum, I can download the file and get the correct checksum with hashlib.md5().hexdigest(), so I know it's uploaded fine...

Appreciate any pointers you might have on this!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the s3fs.open(..., "wb") upload path and the existing checksum() behavior, then review the AWS S3 data-integrity guidance linked in the issue. Define how a caller-supplied checksum should be checked during upload and what IntegrityError behavior should be observable, including cleanup after failure. Done means the requested flow verifies the uploaded object and has coverage for the checksum and failure cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
cloud
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.