GitHub user romainb-met edited a discussion: ObjectStoragePath usage for azure blob storage not working ?
Hello 🖖 I am quite new to airflow and am trying to figure out how to use properly [ObjectStoragePath](https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/objectstorage.html). I am for now using airflow in local, deployed using docker composed, as defined in the [documentation](https://airflow.apache.org/docs/apache-airflow/stable/howto/docker-compose/index.html). I am on 3.0.1. My target is to use a connection towards an azure storage account to perform operations such as listing , downloading, copying, uploading blobs (files). Note that I have a version working relying on `WasbHook ` from microsoft-azure providers. Both alternatives of the code are based on the below connection  Regarding using ObjectStoragePath, I have this simple code : ``` from datetime import datetime from airflow import DAG from airflow.io.path import ObjectStoragePath from airflow.operators.python import PythonOperator def list_files_by_prefix( container: str, prefix: str, wasb_conn_id: str = "sa-login-pwd", ): print("STARTING") src_path = f"wasb://{container}/{prefix}" src = ObjectStoragePath(path=src_path, conn_id=wasb_conn_id) print("LISTING BLOBS FROM SOURCE PREFIX") print(f"Source path dir: {src.path}") blobs = list(src.glob("*")) print(f"Found {len(blobs)} blobs in source path") print(f"blobs: {blobs}") with DAG( dag_id="list_files_by_prefix_in_blob", start_date=datetime(2024, 1, 1), schedule=None, catchup=False, tags=["azure", "mytest"], ) as dag: copy_task = PythonOperator( task_id="list_files_by_prefix", python_callable=list_files_by_prefix, op_kwargs={ "container": "test-container", "prefix": "RAW/", }, ) ``` This dag runs with success but do not complete the task, as you can see in the logs below : ``` [2025-05-16, 14:45:00] INFO - Previous state of the Task instance: TaskInstanceState.QUEUED: chan="stdout": source="task" [2025-05-16, 14:45:00] INFO - Current task name:list_files_by_prefix: chan="stdout": source="task" [2025-05-16, 14:45:00] INFO - Dag name:list_files_by_prefix_in_blob: chan="stdout": source="task" [2025-05-16, 14:45:00] INFO - STARTING: chan="stdout": source="task" [2025-05-16, 14:45:00] INFO - LISTING BLOBS FROM SOURCE PREFIX: chan="stdout": source="task" [2025-05-16, 14:45:00] INFO - Source path dir: .: chan="stdout": source="task" [2025-05-16, 14:45:01] INFO - Found 25 blobs in source path: chan="stdout": source="task" [2025-05-16, 14:45:01] INFO - blobs: [ObjectStoragePath('/.dockerenv'), ObjectStoragePath('/Dockerfile'), ObjectStoragePath('/airflow-scheduler-autorestart'), ObjectStoragePath('/bin'), ObjectStoragePath('/boot'), ObjectStoragePath('/clean-logs'), ObjectStoragePath('/dev'), ObjectStoragePath('/entrypoint'), ObjectStoragePath('/etc'), ObjectStoragePath('/home'), ObjectStoragePath('/lib'), ObjectStoragePath('/lib64'), ObjectStoragePath('/media'), ObjectStoragePath('/mnt'), ObjectStoragePath('/opt'), ObjectStoragePath('/proc'), ObjectStoragePath('/root'), ObjectStoragePath('/run'), ObjectStoragePath('/sbin'), ObjectStoragePath('/scripts'), ObjectStoragePath('/srv'), ObjectStoragePath('/sys'), ObjectStoragePath('/tmp'), ObjectStoragePath('/usr'), ObjectStoragePath('/var')]: chan="stdout": source="task" [2025-05-16, 14:45:01] INFO - Done. Returned value was: None: source="airflow.task.operators.airflow.providers.standard.operators.python.PythonOperator" [2025-05-16, 14:45:01] INFO - Task instance in success state: chan="stdout": source="task" [2025-05-16, 14:45:01] INFO - Previous state of the Task instance: TaskInstanceState.RUNNING: chan="stdout": source="task" [2025-05-16, 14:45:01] INFO - Task operator:<Task(PythonOperator): list_files_by_prefix>: chan="stdout": source="task" ``` So it seems my `src` is pointing.... towards the filesystem of the airflow worker :| Not at all towards the storage account :/ I know that the connection works since it worked using `WasbHook`. Any ideas on what I am missing here ? GitHub link: https://github.com/apache/airflow/discussions/50690 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected]
