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

Add raw query response to cursor class #103

Merged
Changes from 3 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
9 changes: 9 additions & 0 deletions pinotdb/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ def __init__(
self.schema = None
self.rowcount = -1
self._results = None
self.raw_query_response = None
self.timeUsedMs = -1
self._debug = debug
self._preserve_types = preserve_types
Expand Down Expand Up @@ -395,7 +396,15 @@ def finalize_query_payload(
def normalize_query_response(self, input_query, query_response):
try:
payload = query_response.json()
self.raw_query_response = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a test using normal query response and failure results.

As well as v1/v2 query engine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xiangfu0 I have added the tests. Please review.

"response" : payload,
"status_code" : query_response.status_code
}
except Exception as e:
self.raw_query_response = {
"response" : query_response.text,
"status_code" : query_response.status_code
}
raise exceptions.DatabaseError(
f"Error when querying {input_query} from {self.url}, "
f"raw response is:\n{query_response.text}"
Expand Down
Loading