dabla opened a new pull request, #75242:
URL: https://github.com/apache/airflow/pull/75242

   `S3Hook` already has async methods to read and check keys 
(`get_head_object_async`, `check_key_async`, `_list_keys_async`, …) on the 
aiobotocore client of `get_async_conn()`, but none to write. An async task or 
trigger that uploads has to hand `load_bytes()` to a thread.
   
   This adds `S3Hook.aload_bytes()`, the async counterpart of `load_bytes()`, 
with the same parameters and decorators: the bucket comes from an `s3://` key 
or the connection, and it supports `replace`, `encrypt`, `acl_policy`, the 
hook's `extra_args` and requester pays, and records hook lineage. It sends a 
single `PutObject` on the aiobotocore client: no multipart transfer and no 
`transfer_config`, so it is meant for objects below the 5 GB single-upload 
limit, which the docstring says.
   
   Unlike the sync path (`_upload_file_obj()`), it does not add the per-call 
`ServerSideEncryption`/`ACL`/`RequestPayer` settings to the hook's own 
`extra_args`, so they do not carry over into later uploads through the same 
hook.
   
   We have run the same code as a monkey patch in production Dags, uploading 
NDJSON extractions from async tasks.
   
   Tests: four unit tests in `test_s3.py` (upload + lineage, bucket from an 
`s3://` key, refusal of an existing key without `replace`, `extra_args` not 
leaking into the hook). They fail without the change.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 5.5)
   
   Generated-by: Claude Code (Opus 5.5) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to