-
Notifications
You must be signed in to change notification settings - Fork 179
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
Improve the memory efficiency of process_results() override #1050
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 dbt-snowflake contributing guide. |
for row in rows: | ||
fixed_row = [] | ||
for col in row: | ||
if isinstance(col, datetime.datetime) and col.tzinfo: | ||
offset = col.utcoffset() | ||
assert offset is not None | ||
offset_seconds = offset.total_seconds() |
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.
Nit: offset_seconds = offset.total_seconds() or 0
offset_seconds = offset.total_seconds() | ||
new_timezone = pytz.FixedOffset(offset_seconds // 60) | ||
new_timezone = pytz.FixedOffset(int(offset_seconds // 60)) |
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.
pytz
is no longer required as of 3.9+, let's try to remove the dependency here?
https://github.com/stub42/pytz/blob/master/src/README.rst#introduction
resolves #1053
Problem
The existing override of process_results() creates a full copy of query results.
Solution
Iterate over result rows to modify them one by one.
Checklist