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

Records including datetime to be saved as DATETIME or TIMESTAMP in BigQuery #19205

Closed
kennknowles opened this issue Jun 3, 2022 · 3 comments
Closed
Labels
bug core done & done Issue has been reviewed after it was closed for verification, followups, etc. P3 python

Comments

@kennknowles
Copy link
Member

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.


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']

However, this is something perfectly feasible, as google-cloud-python supports it since this issue has been solved: googleapis/google-cloud-python#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?

 

Imported from Jira BEAM-5510. Original Jira may contain additional context.
Reported by: GeoloeG_IsT.

@lazarillo
Copy link
Contributor

It seemed to me that this was more of a Google issue than an Apache Beam issue.

I created an issue here that summarizes the problem, and my humble opinion as to a means to resolve it that is hopefully flexible.

https://issuetracker.google.com/issues/318478318

@lazarillo
Copy link
Contributor

If some core beam devs agree, then maybe we can close this issue. 😄

@kennknowles
Copy link
Member Author

Sounds good to me! It is very old and a fresh report would be probably needed anyhow.

@github-actions github-actions bot added this to the 2.54.0 Release milestone Jan 4, 2024
@damccorm damccorm added the done & done Issue has been reviewed after it was closed for verification, followups, etc. label Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug core done & done Issue has been reviewed after it was closed for verification, followups, etc. P3 python
Projects
None yet
Development

No branches or pull requests

3 participants