googleapis / googleapis/google-cloud-python

Column type selection for BIGNUMERIC vs NUMERIC is incorrect

Đang mở
#15,765 8 bình luận 0 reaction 1 người được giao Được giao cho @Neenu1995 Xem trên GitHub
api: bigquery
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ả

#### Description

There is a discrepancy between the [documentation for numeric types](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#numeric_types) and what appears when creating a numeric column:

> Field \[some_field] has precision \[some_precision] and scale \[some_scale] but precision and scale for NUMERIC must be: 0 <= precision - scale <= 29

_from the BigQuery Console_

#### Environment details

- OS type and version:
- Python version: `Python 3.11.10`
- pip version: `pip 24.0`
- `sqlalchemy-bigquery` version: `Version: 1.12.0`

#### Steps to reproduce

1. Attempt to make a table with a column of type `NUMERIC` with `precision=37` and `scale=0` using SQLAlchemy

#### Code example

```python
import sqlalchemy as sa
from sqlalchemy_bigquery._types import NUMERIC

engine = sa.create_engine("bigquery://")

table = sa.Table(
"test", sa.MetaData(...), sa.Column("id", NUMERIC(37, 0), primary_key=True)
)

table.create(engine)
```

#### Stack trace
```
DatabaseError: (google.cloud.bigquery.dbapi.exceptions.DatabaseError) 400 POST https://bigquery.googleapis.com/bigquery/v2/projects/govis-sandbox/queries?prettyPrint=false: In NUMERIC(P, 0), P must be between
1 and 29 at [3:27]
```

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.