GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix: preserve timestamp microsecond precision with rows from REST API by HemangChothani · Pull Request #402 · googleapis/python-bigquery
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
Conversation
|
| """Coerce 'value' to a datetime, if set or not nullable.""" | ||
| if _not_null(value, field): | ||
| # value will be a float in seconds, to microsecond precision, in UTC. | ||
| return _datetime_from_microseconds(1e6 * float(value)) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This will need to be modified to parse from an rfc timestamp string.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, i didn't get the point. Before passing params["formatOptions.useInt64Timestamp"] = True in client.list_row, received a value in string with decimal in _timestamp_from_json method , but after passing it, received a value in string without decimal and call the method _datetime_from_microseconds(int(value)) which returns datetime object.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Oh I see. Yes, that's expected.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
In this case, we should update the comment.
Also, are there cases where floating point values are still passed in? If not, we should clean this up now. If so, let's add a TODO to identify those cases and file an issue to clean them up.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| elif value.isdigit(): | ||
| value = int(value) | ||
| else: | ||
| value = 1e6 * float(value) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Why is this case needed? Couldn't the above isdigit() check be removed and we always fall back to converting to integer? I don't expect floating point values to be serialized as strings in JSON.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…into bigquery_issue_395
…into bigquery_issue_395
| return _datetime_from_microseconds(1e6 * float(value)) | ||
| # value will be a integer in seconds, to microsecond precision, in UTC. | ||
|
|
||
| # if value is not None: |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Please remove commented out code.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…into bigquery_issue_395
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Use DataFormatOptions to download timestamps with full precision
There was an error while loading. Please reload this page.