Timestamp Returned In Scientific Notation By API Crashes Field Cast

未关闭 适合新手
#17,277 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
技术栈
python
领域
database

调研方向

从 google/cloud/bigquery/_helpers.py 第 264 行附近开始,复现加载以科学计数法返回的时间戳。确认 BigQuery 客户端可以加载该值而不会引发 TypeError,同时保持预期的时间戳行为。

由索引模型根据 Issue 内容生成。

描述

api: bigquery priority: p2 type: bug
Determine this is the right repository
  • 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

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_
主要语言
Python
星标
5.4k
派生
1.8k
平均合并
1 天 17 小时
30 天内合并 PR
93

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

googleapis/google-cloud-python 的其他 Issue

查看 googleapis/google-cloud-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。