Azure / Azure/azure-sdk-for-python

`BlobOperations.delete()` raises error on `status_code = 200`

Open
#41,711 6 comments 0 reactions 2 assignees Claimed by @jalauzon-msft View on GitHub
Client customer-reported needs-team-attention question Service Attention Storage
Dominant language
Python
Stars
5.6k
Forks
3.4k
Avg merge
1d 21h
Merged PRs (30d)
193

Description

- **Package Name**: azure.storage.blob
- **Package Version**: 12.25.1
- **Operating System**: Pop!_OS 22.04 LTS x86_64
- **Python Version**: 3.12

**Describe the bug**
When a 3rd party lib uses the azure.storage.blob to delete a file, it sometimes raises error when delete_blob returns status code 200 OK.

This seems to be an issue here - only accepting 202's
https://github.com/Azure/azure-sdk-for-python/blob/824cc36c5de87b4599bde65925d7fa30e9ab1737/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py#L720

and here:
https://github.com/Azure/azure-sdk-for-python/blob/824cc36c5de87b4599bde65925d7fa30e9ab1737/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py#L2154

**To Reproduce**
Steps to reproduce the behavior:
1. Register filesystem on DuckDB
2. Try to overwrite existing file.

```python
from adlfs import AzureBlobFileSystem
import duckdb

fs = AzureBlobFileSystem(
account_name="myaccount",
anon=False,
)

conn = duckdb.connect()
conn.register_filesystem(fs)

# Create a file
conn.execute("COPY (SELECT 1 AS 'a') TO 'abfs://mycontainer/myfile.parquet'")

# Try to overwrite - sometimes returns status code 200 which raises error
conn.execute("COPY (SELECT 1 AS 'a') TO 'abfs://mycontainer/myfile.parquet'")
```

**Expected behavior**
Should not raise error when successful.

**Screenshots**
N/A

**Additional context**
N/A

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.