Nataneljpwd commented on code in PR #52002:
URL: https://github.com/apache/airflow/pull/52002#discussion_r2160759841


##########
task-sdk/src/airflow/sdk/io/path.py:
##########
@@ -84,6 +86,33 @@ class ObjectStoragePath(CloudPath):
 
     __slots__ = ("_hash_cached",)
 
+    @classmethod
+    def from_conn(cls, conn: Connection, path: str) -> ObjectStoragePath:
+        """
+        Construct an ObjectStoragePath from an Airflow Connection and a 
relative path.
+
+        This method assumes the Connection is of type `objectstore` and 
requires the following
+        keys to be present in its 'extra' JSON configuration:
+
+        - "provider": the scheme or protocol (e.g., "s3", "gs", "file")
+        - "base_path": the base bucket, container, or directory (e.g., 
"my-bucket", "tmp/export")
+
+        The final URI is assembled as: <provider>://<base_path>/<path>, and 
passed to ObjectStoragePath.
+
+        :param conn: Airflow Connection object of type `objectstore`
+        :param path: Relative path to append to the base path
+        :return: ObjectStoragePath instance
+        :raises ValueError: if the connection type is not `objectstore`
+        """
+        if conn.conn_type == "objectstore":

Review Comment:
   Change the check to test whether the conn type  exists in an array of all 
object storage compatible connection types, i.e, s3 and file Conn types.



-- 
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]

Reply via email to