-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix(targets): Safely skip parsing record field as date-time if it is missing in schema #1844
Merged
edgarrmondragon
merged 13 commits into
main
from
1836-bug-_parse_timestamps_in_record-throws-exception-for-key-not-present-in-schema
Sep 28, 2023
Merged
fix(targets): Safely skip parsing record field as date-time if it is missing in schema #1844
edgarrmondragon
merged 13 commits into
main
from
1836-bug-_parse_timestamps_in_record-throws-exception-for-key-not-present-in-schema
Sep 28, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 task
edgarrmondragon
changed the title
fix: Safely ignore parsing record field as datetime if it is missing in schema
fix: Safely skip parsing record field as date-time if it is missing in schema
Jul 14, 2023
Codecov Report
@@ Coverage Diff @@
## main #1844 +/- ##
==========================================
+ Coverage 87.16% 87.39% +0.22%
==========================================
Files 59 59
Lines 5120 5123 +3
Branches 827 828 +1
==========================================
+ Hits 4463 4477 +14
+ Misses 463 451 -12
- Partials 194 195 +1
... and 1 file with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
menzenski
approved these changes
Jul 17, 2023
…exception-for-key-not-present-in-schema
…exception-for-key-not-present-in-schema
edgarrmondragon
changed the title
fix: Safely skip parsing record field as date-time if it is missing in schema
fix(targets): Safely skip parsing record field as date-time if it is missing in schema
Jul 31, 2023
…exception-for-key-not-present-in-schema
…exception-for-key-not-present-in-schema
…exception-for-key-not-present-in-schema
edgarrmondragon
commented
Sep 26, 2023
singer_sdk/sinks/core.py
Outdated
Comment on lines
369
to
371
if key not in schema["properties"]: | ||
self.logger.debug("No schema for record field '%s'", key) | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the in
operator is a bit faster than try-except:
import timeit
setup = """
big_dict = {
i: i * i
for i in range(50_000)
}
"""
try_except = """
for i in range(70_000):
try:
x = big_dict[i]
except KeyError:
continue
"""
in_operator = """
for i in range(70_000):
if i in big_dict:
x = big_dict[i]
"""
print(timeit.timeit(setup=setup, stmt=try_except, number=1000)) # 4.430988875003095
print(timeit.timeit(setup=setup, stmt=in_operator, number=1000)) # 2.137157458000729
…exception-for-key-not-present-in-schema
…exception-for-key-not-present-in-schema
…exception-for-key-not-present-in-schema
edgarrmondragon
deleted the
1836-bug-_parse_timestamps_in_record-throws-exception-for-key-not-present-in-schema
branch
September 28, 2023 23:26
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #1836
📚 Documentation preview 📚: https://meltano-sdk--1844.org.readthedocs.build/en/1844/