-
Notifications
You must be signed in to change notification settings - Fork 11
refactor: FIR-43722 refactor our result set logic from cursors #423
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
refactor: FIR-43722 refactor our result set logic from cursors #423
Conversation
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.
I tried looking to see if I understand and can review the code but I don't know python so it is hard to review a change this big.
One note though: do you want to change the quality gate for python sdk to fail if there are new issues (like new violations or test coverage is not enough). I did change it for JDBC and now the email tells you that he quality gate failed. for python it passes even though there are new issues.
content=query, | ||
timeout=timeout if timeout is not None else USE_CLIENT_DEFAULT, | ||
) | ||
return await self._client.send(req, stream=True) |
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.
was this the default, previous behavior with stream? I thought this is the refactoring and then you will add the streaming functionality.
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.
We used to read the response here fully and then work with the result in memory. Now we stream the response here, and let the RowSet to decide whether to read the stream in memory and process it or (in future streaming implementation) to read it line by line and not store it in memory
83b4bf9
to
f2014db
Compare
@check_not_closed | ||
def __enter__(self) -> Cursor: | ||
return self |
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.
I think we can still support enter, at least to make sure we don't break anything. It's "free" from the looks of it.
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.
We cannot have __enter__
and __exit__
now since close
becomes async aclose
, and we're not able to call it from a sync function anymore
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.
But behind the scenes in async aclose
we call super.close()
so nothing stops us from having sync close
pm cursor that would do the same. I believe one of the reasons why aenter
and aexit
were introduced instead of having async enter
and exit
is to allow an object that's both sync and async context manager.
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.
After discussion, decided to leave a no-op function with a deprecation warning
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.
Added suggestion for clarity, otherwise lgtm
Co-authored-by: Petro Tiurin <93913847+ptiurin@users.noreply.github.com>
|
Refactored out result storing and iteration into a separate RowSet class family. This is a prerequisite to implement support for streaming functionality