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

feat: add sort_by query param to listing record endpoints #3843

Conversation

gabrielmbmb
Copy link
Member

@gabrielmbmb gabrielmbmb commented Sep 27, 2023

Description

This PR adds a sort_by query parameter to the GET /api/v1/datasets/{dataset_id}/records, GET /api/v1/me/datasets/{dataset_id}/records and POST /api/v1/me/datasets/{dataset_id}/records that allows to sort the records by using the inserted_at, updated_at or a metadata property, either in ascending or descending order.

In addition, this PR adds the parse_query_param function that is meant to be used as an endpoint dependency using fastapi.Depends. The function is able to parse query parameters with the format: key1,key2,key3 or key1:value1,value2,value3.

Closes #<issue_number>

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested

Checklist

  • I added relevant documentation
  • I followed the style guidelines of this project
  • I did a self-review of my code
  • I made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I filled out the contributor form (see text above)
  • I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/)

@alvarobartt alvarobartt force-pushed the feature/add-sorting-by-metadata-property-values branch from 69b9345 to e28b24f Compare September 28, 2023 14:43
@gabrielmbmb gabrielmbmb added type: enhancement Indicates new feature requests area: api Indicates that an issue or pull request is related to the Fast API server or REST endpoints labels Sep 28, 2023
@gabrielmbmb gabrielmbmb added this to the v1.17.0 milestone Sep 28, 2023
@gabrielmbmb gabrielmbmb marked this pull request as ready for review September 28, 2023 15:07
@gabrielmbmb gabrielmbmb force-pushed the feature/add-sorting-by-metadata-property-values branch from feeac0b to 354efb7 Compare September 28, 2023 15:08
@codecov
Copy link

codecov bot commented Sep 28, 2023

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Files Coverage Δ
src/argilla/server/enums.py 100.00% <100.00%> (ø)
src/argilla/server/schemas/v1/datasets.py 100.00% <100.00%> (ø)
src/argilla/server/search_engine/base.py 81.60% <100.00%> (-0.15%) ⬇️
src/argilla/server/contexts/datasets.py 98.86% <83.33%> (-0.36%) ⬇️
src/argilla/server/search_engine/commons.py 89.80% <90.00%> (-0.40%) ⬇️
src/argilla/server/apis/v1/handlers/datasets.py 98.66% <96.61%> (+2.75%) ⬆️
src/argilla/server/utils.py 96.82% <96.49%> (-3.18%) ⬇️

... and 2 files with indirect coverage changes

📢 Thoughts on this report? Let us know!.

@github-actions
Copy link

The URL of the deployed environment for this PR is https://argilla-quickstart-pr-3843-ki24f765kq-no.a.run.app

Copy link
Member

@frascuchon frascuchon left a comment

Choose a reason for hiding this comment

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

Just a little comment

@gabrielmbmb gabrielmbmb merged commit 2e22582 into feature/support-for-metadata-filtering-and-sorting Sep 29, 2023
@gabrielmbmb gabrielmbmb deleted the feature/add-sorting-by-metadata-property-values branch September 29, 2023 14:24
@frascuchon frascuchon modified the milestones: v1.17.0, v1.18.0 Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: api Indicates that an issue or pull request is related to the Fast API server or REST endpoints type: enhancement Indicates new feature requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants