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

[dataquery] Add ability to retrieve results of previous run from API #9301

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

driusan
Copy link
Collaborator

@driusan driusan commented Jun 20, 2024

This implements the endpoint that is listed as "aspirational" in the
dataquery api schema to load the results of a previously run query.

It was originally left out for fear of performance issues but with
this implementation performance seems to be comparable to without
it.

This does not implement a frontend to reload query results, but
the API functionality is useful for i.e. api callbacks that want
to process the results of a query without the need to re-run
it (and the possibility to get different results.)

regisoc and others added 2 commits June 19, 2024 14:57
This implements the endpoint that is listed as "aspirational" in the
dataquery api schema to load the results of a previously run query.

It was originally left out for fear of performance issues but with
this implementation performance seems to be comparable to without
it.

This does not implement a frontend to reload query results, but
the API functionality is useful for eg api callbacks that want
to process the results of a query without the need to re-run
it (and the possibility to get different results.)
function (
$candid,
$rowsArray,
/* @phan-suppress-next-line PhanUnusedClosureParameter */
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Closure signature needs to match the callback of DataIteratorBinaryStream, so the unused parameter can't be removed.

*
* @return ResponseInterface
*/
public function countResults(\User $user) : ResponseInterface
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This function was unused in this class, so I removed it while I was cleaning up the code.

public function queryResults(\User $user) : ResponseInterface
{
$db = $this->loris->getDatabaseConnection();
// FIXME: Check permissions. Check if count(*) > 0.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sent as a draft until the permissions checks are added, but otherwise the rest of this PR should be ready to be reviewed or tested.

@driusan driusan added Add to Release Notes PR change should be highlighted in Release notes (important security, features and bugfixes) Feature PR or issue introducing/requiring at least one new feature labels Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Add to Release Notes PR change should be highlighted in Release notes (important security, features and bugfixes) Feature PR or issue introducing/requiring at least one new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants