mesejo opened a new pull request, #1476:
URL: https://github.com/apache/datafusion-python/pull/1476
Closes #899. Users no longer need to call `register_object_store()` before
reading remote files. Two complementary mechanisms are provided:
**Auto-registration from URL scheme**
`try_register_url_store()` is called inside every `read_*` / `register_*`
method. It parses the path, detects the scheme (s3, gs, az/abfss, http/https)
and builds an appropriate `ObjectStore` from environment variables. An existing
registration is never overwritten, so an explicit `register_object_store()`
call still takes precedence. Anonymous S3 access is enabled via
`AWS_SKIP_SIGNATURE=true/1` (avoids EC2 IMDS timeouts when not running on AWS).
**`object_store` parameter on read/register methods** All eight `read_*` /
`register_*` methods (`read_parquet`, `register_parquet`, `read_csv`,
`register_csv`, `read_json`, `register_json`, `read_avro`, `register_avro`) now
accept an optional `object_store` keyword argument. Passing a store instance
registers it for the URL immediately, with no separate call required:
```python
from datafusion.object_store import S3Store
store = S3Store("my-bucket", region="us-east-1", skip_signature=True)
df = ctx.read_parquet("s3://my-bucket/data.parquet", object_store=store)
```
**pyo3-object-store integration**
Replaced the hand-rolled `store.rs` Python classes with `pyo3-object_store
0.9` (compatible with object_store 0.13), which provides richer, actively
maintained Python builders for every backend. The `datafusion.object_store`
module now exposes `S3Store`, `GCSStore`, `AzureStore`, `HTTPStore`,
`LocalStore`, `MemoryStore`, and `from_url`. Legacy names (`AmazonS3`,
`GoogleCloud`, `MicrosoftAzure`, `Http`, `LocalFileSystem`) are kept as
backward-compatible aliases.
`register_object_store(url, store)` now takes a full URL prefix and a
`PyObjectStore` instead of the old `(scheme, StorageContexts, host)` triple,
matching the pattern suggested in #899.
**Tests**
Added integration tests (`@pytest.mark.integration`):
- `test_read_http_csv` - reads CSV from GitHub raw HTTPS
- `test_read_https_parquet` - reads Parquet from Apache parquet-testing
- `test_read_s3_parquet_explicit` - passes `S3Store` via `object_store=`
- `test_read_s3_parquet_auto` - uses `AWS_SKIP_SIGNATURE=true` env var
# Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases. You can
link an issue to this PR using the GitHub syntax. For example `Closes #123`
indicates that this PR will close issue #123.
-->
Closes #.
# Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in
the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your
changes and offer better suggestions for fixes.
-->
# What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is
sometimes worth providing a summary of the individual changes in this PR.
-->
# Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api
change` label.
-->
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]