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

Sample API update #329

Merged
merged 3 commits into from
Sep 1, 2023
Merged

Sample API update #329

merged 3 commits into from
Sep 1, 2023

Conversation

davereinhart
Copy link
Contributor

Updates to warehouse/sample POST endpoint to allow access_role value to be passed. A database constraint will ensure this value is set correctly based on the sample_origin which can be used to identify data from a project that should have restricted access.

@davereinhart davereinhart requested a review from a team as a code owner August 24, 2023 21:46
@davereinhart davereinhart marked this pull request as draft August 24, 2023 21:47
@davereinhart davereinhart marked this pull request as ready for review August 24, 2023 22:14
Copy link
Contributor

@bencap bencap 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 Dave. Thanks for the provenance changes too btw, although I was curious: Would there not be cases where there might be a valid provenance change that we would now miss out on? It might be worth the extra logic to look exclusively at the timestamp.

lib/id3c/db/__init__.py Outdated Show resolved Hide resolved
@davereinhart
Copy link
Contributor Author

Looks good Dave. Thanks for the provenance changes too btw, although I was curious: Would there not be cases where there might be a valid provenance change that we would now miss out on? It might be worth the extra logic to look exclusively at the timestamp.

My thought was that if the only thing changing is the provenance, then the record's actual data is not changing, so the update isn't needed and the new provenance isn't really relevant.

Allow `access_role` value to be set via warehouse/sample POST endpoint. This column is used in the table's row-level security policy to restrict access to specific database roles as needed.
When detecting data changes in sample upsert function, timestamp changes in the `_provenance` were causing otherwise unchanged records to be updated. Removing this value for comparison purposes in a copy of the dict, and retaining the original for insert and update.
@bencap
Copy link
Contributor

bencap commented Aug 30, 2023

Ah ok, that seems fair wrt provenance- Thanks!

@davereinhart davereinhart merged commit 7b1b4ac into master Sep 1, 2023
4 checks passed
@davereinhart davereinhart deleted the sample-api-update branch September 1, 2023 17:16
@davereinhart
Copy link
Contributor Author

Deployed.

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