feat(storage): profile-based S3 auth and hive-partitioned datasets - #2
Merged
Conversation
Read/write data to S3-compatible storage (SwitchCloud) using ~/.aws/credentials profiles, plus a polars-based layer for hive-partitioned Parquet datasets that scale to large tables. - credentials.py: shared resolve_s3_credentials() used by both the boto3 client and the PyArrow filesystem. Precedence: named profile from ~/.aws/credentials, then explicit keys, then S3_* env vars. - dataset.py: get_s3_filesystem(), write_dataset(), read_dataset() for hive-partitioned Parquet with polars; filters prune partitions. - s3.py: get_s3_client() gains a `profile` argument. - storage/README.md: usage guide incl. local-CSV -> partitioned Parquet. - Add polars + pyarrow to the `storage` extra; tests for both.
gmermoud
force-pushed
the
feat/s3-profiles-hive-datasets
branch
from
July 22, 2026 08:54
a943bcc to
23fc41a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Adds a small library to read/write data to Switch Cloud S3 using
~/.aws/credentialsprofiles, plus a scalable Hive-partitioned Parquet dataset layer (using polars).Changes
storage/credentials.py(new, shared) —resolve_s3_credentials(profile, key_id, key_secret)→S3Credentials. Precedence: namedprofilefrom~/.aws/credentials→ explicit keys →S3_ACCESS_KEY_ID/S3_SECRET_ACCESS_KEY. Used by both the boto3 client and the PyArrow filesystem.storage/dataset.py(new) — Hive-partitioned datasets:get_s3_filesystem(endpoint_url, profile=...)→pyarrow.fs.S3FileSystembound to the Switch endpoint.write_dataset(df, fs, bucket, path, partition_cols=[...])— polarsDataFrame/ArrowTable→col=value/partitioned Parquet.read_dataset(fs, bucket, path, columns=..., filters=...)→ polarsDataFrame, with partition pruning viapyarrow.dataset.field(...).storage/s3.py—get_s3_clientgains aprofileargument; credential logic delegated to the shared resolver.storage/README.md(new) — usage guide incl. a local-CSV → partitioned-Parquet-on-S3 walkthrough. Top-levelREADME.mdupdated.pyproject.toml—storageextra now includespolars>=1.0andpyarrow>=15.0.tests/test_dataset.py(new) — round-trips, partition pruning, column projection, credential resolution (incl. profile from a shared-credentials file).Notes
profileis the first credential arg ofget_s3_client, soget_s3_client(endpoint, key_id, key_secret)positionally now needs keywords. Happy to moveprofilelast if preferred./stripped (would silently write to the cwd).Testing
70 tests pass;
ruff check .clean.