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

Add temporary try-catch to handle snapshot time parsing issue #933

Merged

Conversation

mars-lan
Copy link
Contributor

@mars-lan mars-lan commented Aug 1, 2024

🤔 Why?

A bug in google-cloud-bigquery caused the bigquery connector to throw the following error when processing some snapshot tables:

  File "/usr/local/lib/python3.8/site-packages/google/cloud/bigquery/table.py", line 976, in snapshot_definition
    snapshot_info = SnapshotDefinition(snapshot_info)
  File "/usr/local/lib/python3.8/site-packages/google/cloud/bigquery/table.py", line 1372, in __init__
    self.snapshot_time = google.cloud._helpers._rfc3339_to_datetime(
  File "/usr/local/lib/python3.8/site-packages/google/cloud/_helpers/__init__.py", line 252, in _rfc3339_to_datetime
    return datetime.datetime.strptime(dt_str, _RFC3339_MICROS).replace(tzinfo=UTC)
  File "/usr/local/lib/python3.8/_strptime.py", line 568, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/usr/local/lib/python3.8/_strptime.py", line 349, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data '2024-07-23T09:09:09Z' does not match format '%Y-%m-%dT%H:%M:%S.%fZ'

🤓 What?

Add a try-catch around snapshot time retrieval.

🧪 Tested?

Verified against a production instance with known issues.

☑️ Checks

  • My PR contains actual code changes, and I have updated the version number in pyproject.toml.

Copy link

github-actions bot commented Aug 1, 2024

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
11721 10418 89% 85% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
metaphor/bigquery/extractor.py 78% 🟢
TOTAL 78% 🟢

updated for commit: e42eab2 by action🐍

Copy link

codecov bot commented Aug 1, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 6 lines in your changes missing coverage. Please review.

Project coverage is 88.81%. Comparing base (d1e39ee) to head (810c06b).

Files Patch % Lines
metaphor/bigquery/extractor.py 33.33% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #933      +/-   ##
==========================================
- Coverage   88.85%   88.81%   -0.05%     
==========================================
  Files         178      178              
  Lines       11556    11565       +9     
==========================================
+ Hits        10268    10271       +3     
- Misses       1288     1294       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mars-lan mars-lan marked this pull request as ready for review August 1, 2024 14:50
elic-eon
elic-eon previously approved these changes Aug 1, 2024
@mars-lan mars-lan enabled auto-merge (squash) August 2, 2024 04:20
@mars-lan mars-lan disabled auto-merge August 2, 2024 04:21
@mars-lan mars-lan merged commit 69b8e6e into main Aug 2, 2024
4 checks passed
@mars-lan mars-lan deleted the marslan/sc-27798/bigquery-crawler-throws-error-on-datetime branch August 2, 2024 04:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants