Skip to content

Commit

Permalink
Fixed wasb hook attempting to create container when getting a blob cl…
Browse files Browse the repository at this point in the history
…ient (#18287)


Co-authored-by: ignas.kizelevicius <[email protected]>
  • Loading branch information
ignaski and ignaski authored Sep 16, 2021
1 parent f8ba475 commit 2dac083
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions airflow/providers/microsoft/azure/hooks/wasb.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def _get_blob_client(self, container_name: str, blob_name: str) -> BlobClient:
:param blob_name: The name of the blob. This needs not be existing
:type blob_name: str
"""
container_client = self.create_container(container_name)
container_client = self._get_container_client(container_name)
return container_client.get_blob_client(blob_name)

def check_for_blob(self, container_name: str, blob_name: str, **kwargs) -> bool:
Expand Down Expand Up @@ -326,7 +326,8 @@ def upload(
but should be supplied for optimal performance.
:type length: int
"""
blob_client = self._get_blob_client(container_name, blob_name)
container_client = self.create_container(container_name)
blob_client = container_client.get_blob_client(blob_name)
return blob_client.upload_blob(data, blob_type, length=length, **kwargs)

def download(
Expand Down

0 comments on commit 2dac083

Please sign in to comment.