googleapis / googleapis/google-cloud-python

Timestamp Returned In Scientific Notation By API Crashes Field Cast

Đang mở
#17,277 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
api: bigquery priority: p2 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ả

### Determine this is the right repository

- [x] I determined this is the correct repository in which to report this bug.

### Summary of the issue

**Context**
Write a timestamp field to the BigQuery API that was written using UnixTime stamp from python.
Then try to load it as an object.

**Expected Behavior:**
Timestamp comes back without errors.

**Actual Behavior:**
Getting a TypeError when int tries to parse "1.67899e8".

### API client name and version

google-cloud-bigquery

### Reproduction steps: code

See: [google-cloud-bigquery/google/cloud/bigquery/_helpers.py#L264](https://github.com/googleapis/google-cloud-python/blob/main/packages/google-cloud-bigquery/google/cloud/bigquery/_helpers.py#L264)

Line 264 is: return _datetime_from_microseconds(int(value))

The int cast causes the error when the API returns '1.345345e8', which it does.

### Reproduction steps: supporting files

Write a timestamp to bigqurry using time.time()... its accepted.
Load the value back.... causes error.

### Reproduction steps: actual results

### Reproduction steps: expected results

```

### OS & version + platform

_No response_

### Python environment

_No response_

### Python dependencies

_No response_

### Additional context

_No response_

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.