Skip to content

Commit e0c1c0e

Browse files
Nuno Silvanffdiogosilva
authored andcommitted
Fix missing kwargs injection on upload blob call
1 parent 47f6be2 commit e0c1c0e

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

adlfs/spec.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1413,7 +1413,10 @@ async def _pipe_file(self, path, value, overwrite=True, **kwargs):
14131413
container=container_name, blob=path
14141414
) as bc:
14151415
result = await bc.upload_blob(
1416-
data=value, overwrite=overwrite, metadata={"is_directory": "false"}
1416+
data=value,
1417+
overwrite=overwrite,
1418+
metadata={"is_directory": "false"},
1419+
**kwargs,
14171420
)
14181421
self.invalidate_cache(self._parent(path))
14191422
return result

docs/index.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,17 @@ to list all the files or directories in the top-level of a storage container, yo
8282
api.md
8383
```
8484

85+
**Note**: When uploading a blob (with `write_bytes` or `write_text`) you can injects kwargs directly into `upload_blob` method:
86+
87+
```{code-block} python
88+
>>> from azure.storage.blob import ContentSettings
89+
>>> fs = adlfs.AzureBlobFileSystem(account_name="ai4edataeuwest")
90+
>>> fs.write_bytes(path="path", value=data, overwrite=True, **{"content_settings": ContentSettings(content_type="application/json", content_encoding="br")})
91+
```
92+
8593
[fsspec]: https://filesystem-spec.readthedocs.io
8694
[Azure Blob storage]: https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blobs-introduction
8795
[Azure Data Lake Storage Gen2]: https://docs.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-introduction
8896
[Azure Data Lake Storage Gen1]: https://docs.microsoft.com/en-us/azure/data-lake-store/
8997
[`azure.storage.blob`]: https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-python
90-
[fsspec documentation]: https://filesystem-spec.readthedocs.io/en/latest/usage.html
98+
[fsspec documentation]: https://filesystem-spec.readthedocs.io/en/latest/usage.html

0 commit comments

Comments
 (0)