Skip to content

Commit

Permalink
Add support for Oracle Cloud Infrastructure (OCI) (#4244)
Browse files Browse the repository at this point in the history
* [feat]: Add support for Oracle Cloud Infrastructure (OCI) Object Storage filesystem

Signed-off-by: Pedro Antonacio <[email protected]>

* [test]: add test case for OCI protocol

Signed-off-by: Pedro Antonacio <[email protected]>

* update upcoming release notes with the proposed solution

Signed-off-by: Pedro Antonacio <[email protected]>

---------

Signed-off-by: Pedro Antonacio <[email protected]>
  • Loading branch information
antonacio authored Oct 22, 2024
1 parent 9a0a779 commit 6836150
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
**Note:** ``KedroDataCatalog`` is an experimental feature and is under active development. Therefore, it is possible we'll introduce breaking changes to this class, so be mindful of that if you decide to use it already. Let us know if you have any feedback about the ``KedroDataCatalog`` or ideas for new features.

## Bug fixes and other changes
* Added I/O support for Oracle Cloud Infrastructure (OCI) Object Storage filesystem

## Breaking changes to the API
## Documentation changes
* Updated CLI autocompletion docs with new Click syntax.
Expand Down
9 changes: 6 additions & 3 deletions kedro/io/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"gcs",
"gdrive",
"gs",
"oci",
"oss",
"s3",
"s3a",
Expand Down Expand Up @@ -820,9 +821,11 @@ def _parse_filepath(filepath: str) -> dict[str, str]:
host_with_port = parsed_path.netloc.rsplit("@", 1)[-1]
host = host_with_port.rsplit(":", 1)[0]
options["path"] = host + options["path"]
# Azure Data Lake Storage Gen2 URIs can store the container name in the
# 'username' field of a URL (@ syntax), so we need to add it to the path
if protocol == "abfss" and parsed_path.username:
# - Azure Data Lake Storage Gen2 URIs can store the container name in the
# 'username' field of a URL (@ syntax), so we need to add it to the path
# - Oracle Cloud Infrastructure (OCI) Object Storage filesystem (ocifs) also
# uses the @ syntax for I/O operations: "oci://bucket@namespace/path_to_file"
if protocol in ["abfss", "oci"] and parsed_path.username:
options["path"] = parsed_path.username + "@" + options["path"]

return options
Expand Down
1 change: 1 addition & 0 deletions tests/io/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ def test_get_filepath_str(self):
"abfss://[email protected]/mypath",
("abfss", "[email protected]/mypath"),
),
("oci://bucket@namespace/file.txt", ("oci", "bucket@namespace/file.txt")),
("hdfs://namenode:8020/file.txt", ("hdfs", "/file.txt")),
("file:///tmp/file.txt", ("file", "/tmp/file.txt")),
("/tmp/file.txt", ("file", "/tmp/file.txt")),
Expand Down

0 comments on commit 6836150

Please sign in to comment.