diff --git a/RELEASE.md b/RELEASE.md index f4b10035b7..2d267920ce 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -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. diff --git a/kedro/io/core.py b/kedro/io/core.py index 79212dc3ee..a57baba6f5 100644 --- a/kedro/io/core.py +++ b/kedro/io/core.py @@ -51,6 +51,7 @@ "gcs", "gdrive", "gs", + "oci", "oss", "s3", "s3a", @@ -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 diff --git a/tests/io/test_core.py b/tests/io/test_core.py index 286a7142fd..7c30652b6b 100644 --- a/tests/io/test_core.py +++ b/tests/io/test_core.py @@ -263,6 +263,7 @@ def test_get_filepath_str(self): "abfss://mycontainer@mystorageaccount.dfs.core.windows.net/mypath", ("abfss", "mycontainer@mystorageaccount.dfs.core.windows.net/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")),