Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: timestamp precision in insert_rows #393

Merged
merged 3 commits into from Nov 23, 2020

Conversation

@HemangChothani
Copy link
Contributor

@HemangChothani HemangChothani commented Nov 19, 2020

Fixes #392

Copy link
Contributor

@tswast tswast left a comment

Please add a system test for this. It'll need to query the table that rows are inserted into in order to ensure the values roundtrip correctly.

Loading

google/cloud/bigquery/_helpers.py Outdated Show resolved Hide resolved
Loading
@tswast
Copy link
Contributor

@tswast tswast commented Nov 19, 2020

As my explorations showed in #392 (comment), we can format the date using YYYY-MM-DDTHH:MM:SS.MMMMMMZ instead of doing any sort of conversion to floating point.

Loading


when = datetime.datetime(2016, 12, 20, 15, 58, 27, 339328)
self.assertEqual(self._call_fut(when), _microseconds_from_datetime(when) / 1e6)
self.assertEqual(self._call_fut(when), when.strftime(_RFC3339_MICROS))
Copy link
Contributor

@tswast tswast Nov 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update these tests to compare against the actual string produced. I trust that when.strftime(_RFC3339_MICROS) is doing the right thing, but I'd be much more comfortable seeing the actual formatted string here and in the other unit tests.

Loading

tswast
tswast approved these changes Nov 23, 2020
@tswast tswast merged commit a1949ae into googleapis:master Nov 23, 2020
10 checks passed
Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants