Skip to content

Fix handling of timestamps in BigQuery insert data method - #1250

Merged
dhermes merged 2 commits into
googleapis:masterfrom
dhermes:fix-1247
Dec 1, 2015
Merged

Fix handling of timestamps in BigQuery insert data method#1250
dhermes merged 2 commits into
googleapis:masterfrom
dhermes:fix-1247

Conversation

@dhermes

Copy link
Copy Markdown
Contributor

Fixes#1247.

@dhermesdhermes added the api: bigquery Issues related to the BigQuery API. label Nov 30, 2015
@googlebotgooglebot added the cla: yes This human has signed the Contributor License Agreement. label Nov 30, 2015
@dhermesdhermes changed the title Fix handling of timestamps in Bigquery insert data methodFix handling of timestamps in BigQuery insert data methodNov 30, 2015
@dhermes

Copy link
Copy Markdown
ContributorAuthor

I just realized Bigtable has me trained too much. Wrote Bigquery instead of BigQuery in the commit messages.

@dhermes

Copy link
Copy Markdown
ContributorAuthor

FWIW I cherry-picked the second commit onto head and ran the system test with the error reported by @kamatama41 and got the following:

======================================================================ERROR: test_load_table_then_dump_table (bigquery.TestBigQuery)
----------------------------------------------------------------------Traceback (mostrecentcalllast):
File".../gcloud-python/system_tests/bigquery.py", line232, intest_load_table_then_dump_tablerows, _, _=table.fetch_data()
File".../gcloud-python/.tox/system-tests/local/lib/python2.7/site-packages/gcloud/bigquery/table.py", line611, infetch_datarows_data=_rows_from_json(response.get('rows', ()), self._schema)
File".../gcloud-python/.tox/system-tests/local/lib/python2.7/site-packages/gcloud/bigquery/_helpers.py", line81, in_rows_from_jsonrow_data.append(converter(cell['v'], field))
File".../gcloud-python/.tox/system-tests/local/lib/python2.7/site-packages/gcloud/bigquery/_helpers.py", line42, in_datetime_from_jsonreturn_datetime_from_microseconds(1e6*float(value))
File".../gcloud-python/.tox/system-tests/local/lib/python2.7/site-packages/gcloud/_helpers.py", line235, in_datetime_from_microsecondsreturn_EPOCH+datetime.timedelta(microseconds=value)
OverflowError: datevalueoutofrange----------------------------------------------------------------------Ran11testsin69.796s

@tseaver

Copy link
Copy Markdown
Contributor

LGTM. OK to merge w/ pylint failing on Travis, pending #1248.

@dhermes

Copy link
Copy Markdown
ContributorAuthor

I'll just wait for #1248

As stated in the docs
> BigQuery stores TIMESTAMP data internally as a
> UNIX timestamp with microsecond precision
> ...Specifies the number of seconds since the epoch.
@dhermes

Copy link
Copy Markdown
ContributorAuthor

@tseaver Assuming your LGTM still holds after rebasing.

dhermes added a commit that referenced this pull request Dec 1, 2015
Fix handling of timestamps in BigQuery insert data method
@dhermes
dhermes merged commit b4e7534 into googleapis:masterDec 1, 2015
@dhermes
dhermes deleted the fix-1247 branch December 1, 2015 00:59
@kamatama41

Copy link
Copy Markdown

Great job! Thank you for fixing quickly 😄

@dhermes

Copy link
Copy Markdown
ContributorAuthor

Sure thing. Thanks for reporting and finding the bug.

@dhermesdhermes mentioned this pull request Jan 25, 2016
parthea pushed a commit that referenced this pull request Mar 9, 2026
* chore(deps): update all dependencies
* 🦉 Updates from OwlBot post-processor
See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md
---------
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigqueryIssues related to the BigQuery API.cla: yesThis human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@dhermes@tseaver@kamatama41@googlebot