googleapis / googleapis/google-cloud-python

WriteDisposition derives from object, not Enum

オープン
#15,690 コメント 1 件 リアクション 0 件 担当者 1 名 @chalmerlowe が担当を希望しています GitHub で見る
api: bigquery priority: p3 type: bug
主要言語
Python
スター
5.4k
フォーク
1.8k
平均マージ
3日 4時間
マージ済み PR(30日)
122

説明

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"]`
```

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。