simi commented on PR #52002:
URL: https://github.com/apache/airflow/pull/52002#issuecomment-3095917546

   @potiuk I was looking at this again. It is somehow possible to get provider 
out of connection, lookup for filesystem, import and initialize. But it will 
initialize `FileSystem` not `ObjectStorage` anyway and I understand this is not 
intended to be used this way.
   
   ```python
   from airflow.providers_manager import ProvidersManager
   
   pm = ProvidersManager()
   
   def get_filesystems_for_conn_type(conn_type: str) -> list[str] | None:
       for provider_name, provider_info in pm.providers.items():
           for conn_type_info in provider_info.data.get("connection-types", []):
               if conn_type_info.get("connection-type") == conn_type:
                   return provider_info.data.get("filesystems")
   
       return None  # Or raise an error if you want strict behavior
   
   fs = 
get_filesystems_for_conn_type(BaseHook.get_connection('storage').conn_type)[0]
   get_fs = getattr(__import__(fs[0], fromlist=['get_fs']), 'get_fs')
   get_fs('storage')
   <gcsfs.core.GCSFileSystem object at 0x7efcbe1cec60>
   ```
   
   Looking at connection code, it seems to be originally intended mostly for DB 
connections (looking at all the comments in the class) and today the meaning 
changed, but not the class internals. Would it make sense to make it more 
generic and able to store more structured data for example "filesystem info" 
for ObjectStorage out of it?


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