Skip to content

Commit

Permalink
Fix missing kwargs injection on upload blob call
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuno Silva authored and nffdiogosilva committed Feb 9, 2023
1 parent 47f6be2 commit aa7054e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pycqa/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
language_version: python3
Expand Down
5 changes: 4 additions & 1 deletion adlfs/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,10 @@ async def _pipe_file(self, path, value, overwrite=True, **kwargs):
container=container_name, blob=path
) as bc:
result = await bc.upload_blob(
data=value, overwrite=overwrite, metadata={"is_directory": "false"}
data=value,
overwrite=overwrite,
metadata={"is_directory": "false"},
**kwargs,
)
self.invalidate_cache(self._parent(path))
return result
Expand Down
10 changes: 9 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,17 @@ to list all the files or directories in the top-level of a storage container, yo
api.md
```

**Note**: When uploading a blob (with `write_bytes` or `write_text`) you can injects kwargs directly into `upload_blob` method:

```{code-block} python
>>> from azure.storage.blob import ContentSettings
>>> fs = adlfs.AzureBlobFileSystem(account_name="ai4edataeuwest")
>>> fs.write_bytes(path="path", value=data, overwrite=True, **{"content_settings": ContentSettings(content_type="application/json", content_encoding="br")})
```

[fsspec]: https://filesystem-spec.readthedocs.io
[Azure Blob storage]: https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blobs-introduction
[Azure Data Lake Storage Gen2]: https://docs.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-introduction
[Azure Data Lake Storage Gen1]: https://docs.microsoft.com/en-us/azure/data-lake-store/
[`azure.storage.blob`]: https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-python
[fsspec documentation]: https://filesystem-spec.readthedocs.io/en/latest/usage.html
[fsspec documentation]: https://filesystem-spec.readthedocs.io/en/latest/usage.html

0 comments on commit aa7054e

Please sign in to comment.