Skip to content

[RSDK-7443] paginate data #598

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

Merged
merged 7 commits into from
Apr 29, 2024
Merged

Conversation

njooma
Copy link
Member

@njooma njooma commented Apr 29, 2024

No description provided.

@njooma njooma requested a review from a team as a code owner April 29, 2024 16:49
@njooma njooma requested a review from agreenb April 29, 2024 16:51
Copy link
Contributor

@agreenb agreenb left a comment

Choose a reason for hiding this comment

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

Thanks for the quick updates, and for updating BinaryDataByFilter!

Mostly just manually testing questions: Were you able to test these different permutations against the app server? Thinking of looping over 'last' and confirming that it retrieves paginated data (especially with a time interval such that you can test running out of data), requesting with count_only, using the unspecified vs a different limit, using the unspecified vs a DESCENDING sort order?


Args:
filter (viam.proto.app.data.Filter): Optional `Filter` specifying tabular data to retrieve. No `Filter` implies all tabular
data.
limit (int): The maximum number of entries to include in a page. Defaults to 50.
Copy link
Contributor

Choose a reason for hiding this comment

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

In order to match the API undefined fields, can have this default to Optional[int] = None and specify here that if it's unspecified, we'll retrieve 50? That way if the default ever changes in the server code, we don't need to change it in the SDK code as well (and can just update the comment)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup! Didn't realize the server set the limit, thought we had to do it in the client.

Copy link
Contributor

Choose a reason for hiding this comment

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

Great, could possibly update the comment to 'default to 50 if unspecified' to make it clear?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@njooma njooma requested a review from agreenb April 29, 2024 17:14

Args:
filter (viam.proto.app.data.Filter): Optional `Filter` specifying tabular data to retrieve. No `Filter` implies all tabular
data.
limit (int): The maximum number of entries to include in a page. Defaults to 50.
Copy link
Contributor

Choose a reason for hiding this comment

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

Great, could possibly update the comment to 'default to 50 if unspecified' to make it clear?

include_binary_data (bool): Boolean specifying whether to actually include the binary file data with each retrieved file.
Defaults to true (i.e., both the files' data and metadata are returned).
count_only (bool): Whether to return only the total count of entries.
include_internal_data (bool): Whether to return the internal data. Internal data is used for Viam-specific data ingestion,
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we're exposing include_internal_data exposed in the SDK, would great to add the corresponding param for TabularDataByFilter for consistency

Copy link
Member Author

Choose a reason for hiding this comment

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

Should it be included?? I can remove it. I saw it in the proto so I added it

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok added just to make things quick

data_request.limit = limit
if sort_order:
data_request.sort_order = sort_order
if last:
Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome, thanks for updating here and in BinaryDataByFilter! Similar to my PR-level question about testing, could we confirm that keeping these unspecified gives back what we expect in an SDK call?

Copy link
Member Author

Choose a reason for hiding this comment

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

I haven't manually tested this code -- I don't have a robot with a ton of data. But also, this is just client code. I added tests to make sure that the client is forwarding values properly to the server, but beyond that the client is simply going to trust that the server returns back the appropriate data for the request

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it, so confirming that if these are unspecified, the proto field is unspecified. If so, that matches what we'd want.

Copy link
Contributor

Choose a reason for hiding this comment

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

LGTMed, but I just added you into the Data/ML Dev Org so that you can test against this, just so we can be extra sure that this is following the behavior we expect before giving customer updates.

@njooma njooma requested a review from agreenb April 29, 2024 17:33
@njooma njooma merged commit 840984e into viamrobotics:main Apr 29, 2024
12 checks passed
@njooma njooma deleted the RSDK-7443/paginate-data branch April 29, 2024 17:52
njooma added a commit to njooma/viam-python-sdk that referenced this pull request Apr 29, 2024
njooma added a commit that referenced this pull request Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants