-
Notifications
You must be signed in to change notification settings - Fork 17
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
Stream instead of buffer JSON in read_json/write_json #96
Conversation
Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #96 +/- ##
==========================================
- Coverage 55.77% 55.51% -0.26%
==========================================
Files 50 50
Lines 3050 3064 +14
==========================================
Hits 1701 1701
- Misses 1349 1363 +14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Do we need to add some addition test to cover the new changes so we don't accidentally change this behavior? Is it even possible?
Otherwise looks good!
with open(path, "w", encoding="utf-8") as f: | ||
json.dump(data, f, cls=dbt_common.utils.encoding.JSONEncoder) | ||
except Exception as exc: | ||
# See write_file() for an explanation of this error handling. |
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.
Thanks for the helpful comment!
resolves https://dbtlabs.atlassian.net/browse/MNTL-179
Description
There is no reason to keep JSON in memory as an intermediate step during read/write, and it was contributing to max resident set size, so stream it instead.
Checklist
changie new
to create a changelog entry