You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "gecko655 (Jira)" <ji...@apache.org> on 2020/09/02 02:43:00 UTC

[jira] [Comment Edited] (BEAM-5510) Records including datetime to be saved as DATETIME or TIMESTAMP in BigQuery

    [ https://issues.apache.org/jira/browse/BEAM-5510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17187431#comment-17187431 ] 

gecko655 edited comment on BEAM-5510 at 9/2/20, 2:42 AM:
---------------------------------------------------------

It seems the issue is to be resolved as of 2.24.0 because they changed the implementation of beam's "BigQuerySink" to use Google BigQuery's SDK.

You can check the behavior under prior versions with the option `--experiments use_beam_bq_sink`

https://issues.apache.org/jira/browse/BEAM-6928
https://github.com/apache/beam/pull/12203/files


was (Author: gecko655):
It seems the issue is to be resolved as of 2.24.0 because they changed the implementation from beam's own "BigQuerySink" to Google BigQuery's SDK.

You can check the behavior under prior versions with the option `--experiments use_beam_bq_sink`

https://issues.apache.org/jira/browse/BEAM-6928
https://github.com/apache/beam/pull/12203/files

> Records including datetime to be saved as DATETIME or TIMESTAMP in BigQuery
> ---------------------------------------------------------------------------
>
>                 Key: BEAM-5510
>                 URL: https://issues.apache.org/jira/browse/BEAM-5510
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-py-core
>    Affects Versions: 2.6.0
>            Reporter: Pascal Gula
>            Assignee: Pablo Estrada
>            Priority: P3
>
> When trying to write some row in BigQuery that include a python datetime object, the marshaling used to save a row in BigQuery is impossible.
> {code:java}
> File "/home/pascal/Wks/GitHub/PEAT-AI/Albatros/venv/local/lib/python2.7/site-packages/apache_beam/internal/gcp/json_value.py", line 124, in to_json_value
>     raise TypeError('Cannot convert %s to a JSON value.' % repr(obj))
> TypeError: Cannot convert datetime.datetime(2018, 9, 25, 18, 57, 18, 108579) to a JSON value. [while running 'save/WriteToBigQuery']
> {code}
> However, this is something perfectly feasible, as `google-cloud-python` supports it since this issue has been solved: [https://github.com/GoogleCloudPlatform/google-cloud-python/issues/2957]
> thanks to this pull request: [https://github.com/GoogleCloudPlatform/google-cloud-python/pull/3426/files]
> As similar approach could be taken for the `json_value.py` helper.
> Is there any workaround that can be applied to solve this issue? 
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)