0

I am trying to see how can I retrieve the azure connection string value stored in airflow as a connection ID.

I have called the azure blob storage connection id using azure_conn as shown below. I am trying to see how can I return back the connection string from this variable azure_conn

azure_conn = WasbHook(wasb_conn_id='wasb_conn_id')

The variable azure_conn is of type

<class 'airflow.providers.microsoft.azure.hooks.wasb.WasbHook'>

1 Answer 1

1

The WasbHook has access to a get_connection() method inherited from the BaseHook (see here). You can instantiate the WasbHook as you do now and then call the get_connection() method to retrieve attributes from the Azure Blob Storage Connection you setup.

hook = WasbHook(wasb_conn_id='wasb_conn_id')
conn = hook.get_connection(hook.conn_id)
print(conn.extra_dejson) # To retrieve the connection string
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.