This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new a67427af37 Fix get_blobs_list_async method to return BlobProperties
(#32545)
a67427af37 is described below
commit a67427af3738218786f3745d9737f462c70d4233
Author: Jarek Potiuk <[email protected]>
AuthorDate: Wed Jul 12 09:11:54 2023 +0200
Fix get_blobs_list_async method to return BlobProperties (#32545)
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.
---
airflow/providers/microsoft/azure/CHANGELOG.rst | 10 ++++++++++
airflow/providers/microsoft/azure/hooks/wasb.py | 4 ++--
airflow/providers/microsoft/azure/provider.yaml | 1 +
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/airflow/providers/microsoft/azure/CHANGELOG.rst
b/airflow/providers/microsoft/azure/CHANGELOG.rst
index df78b4e7a8..b05f1c9310 100644
--- a/airflow/providers/microsoft/azure/CHANGELOG.rst
+++ b/airflow/providers/microsoft/azure/CHANGELOG.rst
@@ -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
.....
diff --git a/airflow/providers/microsoft/azure/hooks/wasb.py
b/airflow/providers/microsoft/azure/hooks/wasb.py
index 794da8dd85..2281e184c2 100644
--- a/airflow/providers/microsoft/azure/hooks/wasb.py
+++ b/airflow/providers/microsoft/azure/hooks/wasb.py
@@ -687,10 +687,10 @@ class WasbAsyncHook(WasbHook):
: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:
diff --git a/airflow/providers/microsoft/azure/provider.yaml
b/airflow/providers/microsoft/azure/provider.yaml
index 441f51a578..a120882204 100644
--- a/airflow/providers/microsoft/azure/provider.yaml
+++ b/airflow/providers/microsoft/azure/provider.yaml
@@ -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