googleapis / googleapis/google-cloud-python

WriteDisposition derives from object, not Enum

Đang mở
#15,690 1 bình luận 0 reaction 1 người được giao Được @chalmerlowe nhận Xem trên GitHub
api: bigquery priority: p3 type: bug
Ngôn ngữ chính
Python
Star
5.4k
Fork
1.8k
Merge trung bình
3 ngày 4 giờ
Pull request đã merge (30 ngày)
122

Mô tả

Unlike many of the other enumerations defined in google/cloud/bigquery/enums.py, `WriteDisposition` derives from `object`, not `enum.Enum` and therefore `WriteDisposition` can't easily be used as a type annotation in method args where you want to set a default disposition.

#### Environment details

- OS type and version: macOS 15.7.3
- Python version: 3.13.2
- pip version: 25.3
- `google-cloud-bigquery` version: 3.40.0

#### Steps to reproduce

1. Define a function which simplifies calls to BQ and takes a WriteDisposition as a parameter
2. Set a default value for the WriteDisposition parameter
3. Fail to type check with `ty`

#### Code example

Something like:
```python
def write_to_bq(write_type: WriteDisposition = WriteDisposition.WRITE_APPEND)
```

Results in an [invalid-argument] type checking error from `ty` with a message like:

```
Expected `WriteDisposition`, found `Unknown | Literal["WRITE_APPEND"]`
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.