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

PROD-2473 Update GET /dataset endpoint to support exclude_saas_datasets and only_unlinked_datasets params #5132

Merged
merged 6 commits into from
Jul 31, 2024

Conversation

erosselli
Copy link
Contributor

@erosselli erosselli commented Jul 26, 2024

Closes PROD-2473

Description Of Changes

Added two query params exclude_saas_datasets and only_unlinked_datasets to the GET /datasets endpoint to match those in GET /filters/datasets.

Code Changes

  • Updated list_dataset_paginated to add the two new filter options, exclude_saas_datasets and only_unlinked_datasets
  • Added relevant unit tests
  • Added comment to docstring for GET /filter/datasets endpoint

Steps to Confirm

  • list any manual steps for reviewers to confirm the changes

Pre-Merge Checklist

  • All CI Pipelines Succeeded
  • Documentation:
    • documentation complete, PR opened in fidesdocs
    • documentation issue created in fidesdocs
    • if there are any new client scopes created as part of the pull request, remember to update public-facing documentation that references our scope registry
  • Issue Requirements are Met
  • Relevant Follow-Up Issues Created
  • Update CHANGELOG.md
  • For API changes, the Postman collection has been updated
  • If there are any database migrations:
    • Ensure that your downrev is up to date with the latest revision on main
    • Ensure that your downgrade() migration is correct and works
      • If a downgrade migration is not possible for this change, please call this out in the PR description!

Copy link

vercel bot commented Jul 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
fides-plus-nightly ⬜️ Ignored (Inspect) Visit Preview Jul 31, 2024 3:22pm

Copy link

cypress bot commented Jul 26, 2024



Test summary

4 0 0 0


Run details

Project fides
Status Passed
Commit 76a3da4 ℹ️
Started Jul 31, 2024 3:34 PM
Ended Jul 31, 2024 3:34 PM
Duration 00:35 💡
OS Linux Ubuntu -
Browser Electron 106

View run in Cypress Cloud ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Cloud

Copy link

codecov bot commented Jul 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.55%. Comparing base (135b030) to head (a336897).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5132   +/-   ##
=======================================
  Coverage   86.54%   86.55%           
=======================================
  Files         357      357           
  Lines       22331    22340    +9     
  Branches     2955     2957    +2     
=======================================
+ Hits        19327    19336    +9     
  Misses       2480     2480           
  Partials      524      524           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@erosselli erosselli changed the title Add exclude_saas_datasets filter to datasets list endpoint PROD-2463 Update GET /api/v1/dataset endpoint to support remove_saas_datasets and only_unlinked_datasets params Jul 29, 2024
@erosselli erosselli changed the title PROD-2463 Update GET /api/v1/dataset endpoint to support remove_saas_datasets and only_unlinked_datasets params PROD-2473 Update GET /api/v1/dataset endpoint to support exclude_saas_datasets and only_unlinked_datasets params Jul 29, 2024
@erosselli erosselli force-pushed the PROD-2473 branch 2 times, most recently from f012119 to 8f70226 Compare July 29, 2024 13:37
@erosselli erosselli marked this pull request as ready for review July 29, 2024 13:41
@erosselli erosselli changed the title PROD-2473 Update GET /api/v1/dataset endpoint to support exclude_saas_datasets and only_unlinked_datasets params PROD-2473 Update GET `/api/v1/dataset endpoint to support exclude_saas_datasets and only_unlinked_datasets params Jul 29, 2024
@erosselli erosselli changed the title PROD-2473 Update GET `/api/v1/dataset endpoint to support exclude_saas_datasets and only_unlinked_datasets params PROD-2473 Update GET /dataset endpoint to support exclude_saas_datasets and only_unlinked_datasets params Jul 29, 2024
@galvana galvana self-requested a review July 30, 2024 15:58
Copy link
Contributor

@galvana galvana left a comment

Choose a reason for hiding this comment

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

Looks good! I just have one question about backwards compatibility and a suggestion for Swagger

@@ -591,6 +591,7 @@ def get_ctl_datasets(
only_unlinked_datasets: bool = False,
) -> List[Dataset]:
"""
Deprecated. Use `GET /datasets` instead.
Copy link
Contributor

Choose a reason for hiding this comment

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

You can add a deprecated flag to the router info, here's an example:

@router.get(
    PRIVACY_REQUESTS,
    dependencies=[Security(verify_oauth_client, scopes=[PRIVACY_REQUEST_READ])],
    response_model=Page[
        Union[
            PrivacyRequestVerboseResponse,
            PrivacyRequestResponse,
        ]
    ],
    deprecated=True,
)
def get_request_status(

Then it will be nice and obvious in the Swagger docs
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah cool! didn't know this 😎

taxonomy_model=CtlDataset,
filter_params=filter_params,
if not page and not size:
return await list_resource(CtlDataset, db)
Copy link
Contributor

Choose a reason for hiding this comment

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

We would need to apply the exclude_saas_datasets and only_unlinked_datasets filters to the non-paginated response if we wanted to keep backwards compatibility. Did we make a decision to omit this?

Copy link
Contributor Author

@erosselli erosselli Jul 30, 2024

Choose a reason for hiding this comment

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

hmm that's a good point. I can definitely add them in -- however I think the idea was to at some point in the future deprecate the non-paginated response entirely since it has performance issues when there's a big number of elements, and the existing non-paginated endpoint with the filters (/filters/dataset) still exists so it can be used if that's still needed.

What do you think? I think ideally if anyone wants to move from the deprecated endpoint to the new one, they should probably add in the pagination support while they're at it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added it in 071258d

@@ -2001,7 +2001,7 @@ def test_list_dataset_no_pagination(
api_client: TestClient,
generate_auth_header,
ctl_dataset,
saas_ctl_dataset,
secondary_sendgrid_instance,
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice reuse!

Copy link
Contributor

@galvana galvana 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 making the changes, I'm glad it didn't end up being a big change!

@erosselli erosselli merged commit d5fb94e into main Jul 31, 2024
45 checks passed
@erosselli erosselli deleted the PROD-2473 branch July 31, 2024 16:06
Copy link

cypress bot commented Jul 31, 2024



Test summary

4 0 0 0


Run details

Project fides
Status Passed
Commit d5fb94e
Started Jul 31, 2024 4:18 PM
Ended Jul 31, 2024 4:19 PM
Duration 00:35 💡
OS Linux Ubuntu -
Browser Electron 106

View run in Cypress Cloud ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Cloud

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.

2 participants