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.
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 pagination and base_url to JSON query_runner #6499
add pagination and base_url to JSON query_runner #6499
Changes from all commits
6902fd4
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 85 in redash/query_runner/json_ds.py
Codecov / codecov/patch
redash/query_runner/json_ds.py#L85
Check warning on line 161 in redash/query_runner/json_ds.py
Codecov / codecov/patch
redash/query_runner/json_ds.py#L161
Check warning on line 163 in redash/query_runner/json_ds.py
Codecov / codecov/patch
redash/query_runner/json_ds.py#L163
Check warning on line 165 in redash/query_runner/json_ds.py
Codecov / codecov/patch
redash/query_runner/json_ds.py#L165
Check warning on line 168 in redash/query_runner/json_ds.py
Codecov / codecov/patch
redash/query_runner/json_ds.py#L167-L168
Check warning on line 191 in redash/query_runner/json_ds.py
Codecov / codecov/patch
redash/query_runner/json_ds.py#L191
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.
Having this many nested
if
statements is kind of a code smell. Maybe we should split this up into multiple functions?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 could, but there are kind of a lot of variables to pass around to do so. I personally would just pass
query
around instead of breaking it up on line 168 and then passing that around everywhere. I was just trying to change as little as possible. Should I do that switch?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.
In my opinion, yes - definitely worth it if it makes the code easier to follow.
Check warning on line 224 in redash/query_runner/json_ds.py
Codecov / codecov/patch
redash/query_runner/json_ds.py#L222-L224
Check warning on line 234 in redash/query_runner/json_ds.py
Codecov / codecov/patch
redash/query_runner/json_ds.py#L234
Check warning on line 239 in redash/query_runner/json_ds.py
Codecov / codecov/patch
redash/query_runner/json_ds.py#L239
Check warning on line 246 in redash/query_runner/json_ds.py
Codecov / codecov/patch
redash/query_runner/json_ds.py#L246
Check warning on line 253 in redash/query_runner/json_ds.py
Codecov / codecov/patch
redash/query_runner/json_ds.py#L253
Check warning on line 268 in redash/query_runner/json_ds.py
Codecov / codecov/patch
redash/query_runner/json_ds.py#L268
Check warning on line 279 in redash/query_runner/json_ds.py
Codecov / codecov/patch
redash/query_runner/json_ds.py#L279
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.
Ah, sorry, I should have specified. We've been aiming for pytest tests instead of unittest; if it's not too much trouble, would you mind converting to those? I won't hold it against you if you're not feeling up to it though. I appreciate the work you've put into this PR and already recognize you've gone above and beyond :)
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 just used the other tests as an example. It could always be refactored later. It seems like some of that should be added to the contributing guide, like the testing, ruff, and rebasing process. Like are you looking for a single commit per pr, or just going for a linear history?
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.
That's a great point. I don't think we have a good handle on what our contribution guidelines are; I'll try and add some documentation for that to the wiki soon.