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(targets): Safely skip parsing record field as date-time if it is missing in schema #1844

Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions singer_sdk/sinks/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,16 @@ def _parse_timestamps_in_record(
schema: TODO
treatment: TODO
"""
for key in record:
datelike_type = get_datelike_property_type(schema["properties"][key])
for key, value in record.items():
try:
datelike_type = get_datelike_property_type(schema["properties"][key])
except KeyError:
self.logger.debug("No schema for record field '%s'", key)
continue
if datelike_type:
date_val = record[key]
date_val = value
try:
if record[key] is not None:
if value is not None:
date_val = parser.parse(date_val)
except parser.ParserError as ex:
date_val = handle_invalid_timestamp_in_record(
Expand Down