Skip to content

Commit

Permalink
Fix get_blobs_list_async method to return BlobProperties (#32545)
Browse files Browse the repository at this point in the history
The get_blobs_list_async method advertised to return list of
BlobProperties but returned list of blob names. This is a bug
that has been detected by MyPy checks with the new Azure blob
package.
  • Loading branch information
potiuk authored Jul 12, 2023
1 parent fd2687d commit a67427a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
10 changes: 10 additions & 0 deletions airflow/providers/microsoft/azure/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@
Changelog
---------

6.2.1
.....

.. note::
Note: this version contains a fix to ``get_blobs_list_async`` method in ``WasbHook`` where it returned
a list of blob names, but advertised (via type hints) that it returns a list of ``BlobProperties`` objects.
This was a bug in the implementation and it was fixed in this release. However, if you were relying on the
previous behaviour, you might need to retrieve ``name`` property from the array elements returned by
this method.

6.2.0
.....

Expand Down
4 changes: 2 additions & 2 deletions airflow/providers/microsoft/azure/hooks/wasb.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,10 +687,10 @@ async def get_blobs_list_async(
:param delimiter: filters objects based on the delimiter (for e.g '.csv')
"""
container = self._get_container_client(container_name)
blob_list = []
blob_list: list[BlobProperties] = []
blobs = container.walk_blobs(name_starts_with=prefix, include=include, delimiter=delimiter, **kwargs)
async for blob in blobs:
blob_list.append(blob.name)
blob_list.append(blob)
return blob_list

async def check_for_prefix_async(self, container_name: str, prefix: str, **kwargs: Any) -> bool:
Expand Down
1 change: 1 addition & 0 deletions airflow/providers/microsoft/azure/provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ description: |
`Microsoft Azure <https://azure.microsoft.com/>`__
suspended: false
versions:
- 6.2.1
- 6.2.0
- 6.1.2
- 6.1.1
Expand Down

0 comments on commit a67427a

Please sign in to comment.