Skip to content

[cherry-pick][2.60.1][Data] Stop writing Unity Catalog vended AWS credentials to the environment (#67899) - #68232

Merged
sai-miduthuri merged 1 commit into
ray-project:releases/2.60.1from
abhishekverma-ray:abhishekverma/cherry-pick-67899-2.60.1
Nov 18, 2026
Merged

sai-miduthuri merged 1 commit into
ray-project:releases/2.60.1from
abhishekverma-ray:abhishekverma/cherry-pick-67899-2.60.1

Conversation

@abhishekverma-ray

Copy link
Copy Markdown
Contributor

Description

Backport of #67899 (master commit 596241a) onto releases/2.60.1, AWS part only. It's based directly on releases/2.60.1 and is independent of #68213 / #68214 and the #67898 pick; all of them merge with it without conflicts.

On this branch, DatabricksUnityCatalog.resolve() writes vended AWS credentials into the driver's os.environ and, if Ray isn't running yet, starts Ray with them in runtime_env. AWS env vars take precedence over the instance role, so after one Unity Catalog read the driver and every worker use a short-lived credential scoped to that one table. Writes to the job's own buckets (checkpoints, logs) then fail with ACCESS_DENIED.

With this PR, AWS credentials travel only in the objects that use them, which pickle into the read and write tasks:

  • An explicit S3FileSystem for every reader and mode. Before, AWS Parquet reads used the environment.
  • For Delta, the AWS keys and region in storage_options, for deltalake's log read and the write_delta commit. read_delta, write_delta and the datasink's credential refresh already merge resolved.storage_options on this branch.

GCS was already environment-free and is unchanged. A response with no known credential type still raises ValueError.

Behavior changes worth a release note (the same as on master):

  • AWS Parquet reads through Unity Catalog now need region, which the DatabricksUnityCatalog docstring already lists as required for AWS.
  • Code that relied on the vended AWS keys being in the environment afterwards no longer gets them.

Related issues

Related to #67899.

Additional information

How this differs from #67899

releases/2.60.1 doesn't have the Azure Unity Catalog work #67899 edits (#66272–#66276: Azure SAS in storage_options, AzureFileSystem for Parquet, Azurite tests). So git cherry-pick conflicts in catalog.py and test_catalog.py and tries to bring in that Azure code and the Gravitino catalog. I ported the AWS change by hand instead:

  • Azure is unchanged. It still gets the SAS through _apply_env (the environment plus runtime_env), because nothing else delivers it on this branch. Removing that would break Azure reads. _creds_to_env is gone: Azure calls _parse_azure_creds directly, and the unknown-type ValueError moved into _resolve_storage, as on master.
  • Not taken: master's delta_datasink.py and test_write_delta.py changes. They're comment-only and say Unity Catalog never touches the environment, which is still false for Azure here. test_catalog_azure.py doesn't exist on this branch.
  • Tests: master's strict isolated_env fixture (environment must come back unchanged, ray.init fails if called) covers every AWS and GCS resolve() test. The two Azure tests keep the old lenient fixture, renamed azure_env. Master deleted test_resolve_initializes_ray_with_runtime_env; here it becomes test_resolve_azure_initializes_ray_with_runtime_env, since Azure still does that. As on master, test_resolve_aws_requires_region covers both readers, and test_resolve_rejects_unknown_credential_type and the storage_options asserts in the write_delta test are added.

Not a duplicate: no open or merged PR against releases/2.60.1 picks #67899.

Testing

test_catalog.py skips the whole module without databricks-sdk, and this branch's Data CI locks don't include it, so CI doesn't run these tests here. I ran them locally:

Command Result
pre-commit (commit hooks) on the 2 changed files Passed
pytest test_catalog.py (databricks-sdk 0.143.0) 36 passed. On releases/2.60.1: 34
The same with releases/2.60.1's catalog.py 8 failed and 7 fixture errors: every AWS resolve() test, the Parquet region check, and the write_delta storage_options asserts
pytest datasource/test_write_delta.py 101 passed
pytest datasource/test_delta.py 15 passed
pytest unit/datasource/ 83 passed

Each file ran in its own pytest process. Environment: Python 3.12.10 with the Ray 2.60.0 release wheel, this branch's python/ray/data and python/ray/tests linked over it, and the CI lock pins: pyarrow 23.0.1, pandas 2.3.3, numpy 2.2.6, deltalake 1.5.0, pytest 7.4.4.

Not checked on a real Databricks workspace, as with #67899 on master.

AI assistance was used to prepare this backport; every line has been reviewed by the submitter.

🤖 Generated with Claude Code

…onment (ray-project#67899)

Backport of ray-project#67899 to 2.60.1, AWS part only. releases/2.60.1 doesn't have
the Azure Unity Catalog changes ray-project#67899 edits (ray-project#66272-ray-project#66276), so on this
branch Azure still delivers its SAS through the environment.

- AWS: an explicit S3FileSystem for every reader and mode, plus the AWS keys
  and region in `storage_options` for Delta. Nothing is written to
  `os.environ` and Ray isn't started.
- GCS: unchanged (it never used the environment).
- Azure: unchanged (still `_apply_env`).
- `_creds_to_env` is removed; an unknown credential type still raises.

(cherry picked from commit 596241a)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Abhishek Verma <[email protected]>
@abhishekverma-ray
abhishekverma-ray marked this pull request as ready for review November 17, 2026 04:00
@abhishekverma-ray
abhishekverma-ray requested a review from a team as a code owner November 17, 2026 04:00
@abhishekverma-ray abhishekverma-ray added data Ray Data-related issues go add ONLY when ready to merge, run all tests labels Nov 17, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors how vended credentials are handled in the Databricks Unity Catalog integration. Specifically, AWS and GCP credentials are no longer written to the environment or cluster runtime_env (which could override instance roles for other cloud accesses); instead, they are passed directly via explicit pyarrow filesystems and storage_options for deltalake. Azure credentials continue to be propagated via environment variables. The unit tests have been updated to ensure that environment variables remain unchanged for AWS and GCP, and to verify the correct population of storage_options. I have no feedback to provide as there are no review comments.

@rayhhome rayhhome self-assigned this Nov 17, 2026

@rayhhome rayhhome left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@sai-miduthuri
sai-miduthuri merged commit 359e4e7 into ray-project:releases/2.60.1 Nov 18, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data Ray Data-related issues go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants